随笔分类 - 数学&算法
数学及算法
摘要: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; } } ...
阅读全文
摘要: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...
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:namespace DSList{ //有向图邻接矩阵类(Directed Graph Adjacency Matrix Class) public class DireGraAdjMatrix<T> : IDireGraph<T> { //Fields private GvNode<T>[] nodes; private int numArcs; private int[,] matrix; //Constructor public DireGraAdjMatrix(int n) { nodes = new GvNode<T>[n]; numA
阅读全文
摘要:namespace DSList{ //有向图邻接表类(Directed Graph Adjacency List Class) public class DireGraAdjList<T> : IDireGraph<T> { private ALVexNode<T>[] adjList; public ALVexNode<T> this[int index] { get { return adjList[index]; } set { adjList[index] = value; } } publi...
阅读全文
摘要:namespace DSList{ //有向图接口类 public interface IDireGraph<T> { int GetNumOfVertex(); //获取顶点的数目 int GetNumOfArc(); //获取弧的数目 bool IsGvNode(GvNode<T> v); //v是否为图的顶点 int GetIndex(GvNode<T> v); //获得顶点V在顶点数组中的索引 void SetArc(GvNode<T> v1, GvNode<T> v2, int v); //在顶点v1和v2之间添加权值为v的
阅读全文
浙公网安备 33010602011771号