Skip to content

Commit 58c44ec

Browse files
committed
20160302
0 parents  commit 58c44ec

File tree

7 files changed

+59
-0
lines changed

7 files changed

+59
-0
lines changed

.test.php.swp

12 KB
Binary file not shown.

Graphic/.AdjMatrix.php.swp

12 KB
Binary file not shown.

Graphic/.Vertex.php.swp

12 KB
Binary file not shown.

Graphic/Edge.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Graphic;
4+
5+
class Edge {
6+
7+
public $vex_head;
8+
9+
public $vex_tail;
10+
11+
public $weight;
12+
13+
public function __construct($vex_head, $vex_tail, $weight) {
14+
$this->vex_head = $vex_head;
15+
$this->vex_tail = $vex_tail;
16+
$this->weight = $weight;
17+
}
18+
}

Graphic/Vertex.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Graphic;
4+
5+
class Vertex {
6+
public $name;
7+
public $data;
8+
public $visited;
9+
10+
public function __construct($name, $data = 0, $visited = 0) {
11+
$this->name = $name;
12+
$this->data = $data;
13+
$this->visited = $visited;
14+
}
15+
}

index.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head>
3+
4+
<head>
5+
<body>
6+
<div><a href='../test.php' />hello</div>
7+
</body>
8+
</html>

test.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
require_once __DIR__.'/Graphic/Vertex.php';
4+
#require_once __DIR__.'/Graphic/Edge.php';
5+
6+
use Graphic\Vertex;
7+
use Graphic\Edge;
8+
9+
$begin_int = ord('A');
10+
$vertexex = array();
11+
//定义结点,初始化A-E的节点,节点上数据为i
12+
for ($i = 0; $i < 9; $i++) {
13+
$vertexex [] = new Vertex(chr($begin_int + $i));
14+
}
15+
print_r($vertexex);
16+
//定义边
17+
18+
//初始化邻接矩阵

0 commit comments

Comments
 (0)