摘要: namespace DSList{ public interface IGraph<T> { int GetNumOfVertex(); //获取顶点的数目 int GetNumOfEdge(); //获取边的数目 bool IsGvNode(GvNode<T> v); //v是否为图的顶点 int GetIndex(GvNode<T> v); //获得顶点V在顶点数组中的索引 void SetEdge(GvNode<T> v1, GvNode<T> v2, int v); //在顶点v1和v2之间添加权值为v的边 void DelE 阅读全文
posted @ 2013-04-26 10:17 小泥巴1024 阅读(93) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //无向图邻接矩阵的顶点结点类(Undirected Graph Adjaceney Matrix of Vertex Node) public class GvNode<T> { private T data; public T Data { get { return data; } set { data = value; } } public GvNode(T val) { data = val; } }} 阅读全文
posted @ 2013-04-26 10:16 小泥巴1024 阅读(132) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //无向图邻接矩阵类(Undirected Graph Adjacency Matrix Class) public class GraphAdjMatrix<T> : IGraph<T> { //Fields private GvNode<T>[] nodes; //vertex array private int numEdges; //Edges number private int[,] matrix; //Matrix array //Constructor public GraphAdjMatrix(int . 阅读全文
posted @ 2013-04-26 10:12 小泥巴1024 阅读(154) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //无向图邻接表的邻接结点类(Undirected Graph Adjacency List of Adjaceney Node) public class AdjListNode<T> { private int adjVex; private AdjListNode<T> next; private int weight; public int AdjVex { get { return adjVex; } set { adjVex = value; } } ... 阅读全文
posted @ 2013-04-26 10:11 小泥巴1024 阅读(156) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //无向图邻接表的顶点结点类(Undirected Graph Adjacency List of Vertex Node) public class ALVexNode<T> { private GvNode<T> data; private AdjListNode<T> firstAdj; public GvNode<T> Data { get { return data; } set { data = value; } } public AdjListNod... 阅读全文
posted @ 2013-04-26 10:10 小泥巴1024 阅读(155) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //无向图邻接表类(Undirected Graph Adjacency List Class) public class GraphAdjList<T> : IGraph<T> { //Fields private ALVexNode<T>[] adjList; //Vertex array private int[] visited; //Auxiliary array of DFS() or BFS() //Property public ALVexNode<T> this[int index] { ge 阅读全文
posted @ 2013-04-26 10:09 小泥巴1024 阅读(169) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //无向网邻接矩阵类(Undirected Net Adjacency Matrix Class) public class NetAdjMatrix<T> : IGraph<T> { //Fields private GvNode<T>[] nodes; private int numEdges; private int[,] matrix; //Constructor public NetAdjMatrix(int n) { nodes = new GvNode<T>[n]; matrix = new in 阅读全文
posted @ 2013-04-26 10:07 小泥巴1024 阅读(165) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //有向网邻接矩阵类(Directed Net Adjacency Matrix Class) public class DireNetAdjMatrix<T> : IDireGraph<T> { //Fields private GvNode<T>[] nodes; //有向网的顶点数组 private int numArcs; //弧的数目 private int[,] matrix; //邻接矩阵数组 //Constructor public DireNetAdjMatrix(int n) { nodes ... 阅读全文
posted @ 2013-04-26 10:06 小泥巴1024 阅读(240) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //无向网邻接表类(Undirected Net Adjacency List Class) public class NetAdjList<T> : IGraph<T> { //Field private ALVexNode<T>[] adjList; //vertex array //Property public ALVexNode<T> this[int index] { get { return adjList[index]; } set { adjList[i... 阅读全文
posted @ 2013-04-26 10:04 小泥巴1024 阅读(240) 评论(0) 推荐(0) 编辑
摘要: namespace DSList{ //有向网邻接表类(Directed Net Adjacency List Class) public class DireNetAdjList<T> : IDireGraph<T> { //Field private ALVexNode<T>[] adjList; //Property public ALVexNode<T> this[int index] { get { return adjList[index]; } set { adjList[index] = val... 阅读全文
posted @ 2013-04-26 10:02 小泥巴1024 阅读(114) 评论(0) 推荐(0) 编辑