c++
BrownEyedBoogie
这个作者很懒,什么都没留下…
展开
-
Adjacency List表示下Depth-First-Search(DFS)及Breadth-First-Search(BFS)的c++实现
1. Interface (Graph.h, listQueue.h)#ifndef GRAPH_H_INCLUDED#define GRAPH_H_INCLUDEDclass Graph{private: struct adjListNode{ int node; adjListNode* next; adjListNode(int x, adjListNode* t原创 2017-07-11 11:39:45 · 595 阅读 · 0 评论 -
Adjacency Matrix -- c++实现
1. Adjacency Matrix (Undirected Graph)i. Header (Graph.h)#ifndef GRAPH_H_INCLUDED#define GRAPH_H_INCLUDEDclass Graph{private: bool** adjMat; // implement the matrix by a 2-D bool array in原创 2017-07-05 12:08:04 · 746 阅读 · 0 评论 -
Minimum Spanning Tree (MST) -- Prim's Algorithm (c++实现)
1. 假设图为无向图,用adjacency matrix表示。Adjacency matrix见Adjacency Matrix -- c++实现2. 链接的中的程序当两节点为相连时将adjacency matrix中相应元素置1。MST问题中需考虑边的权重,因此连接时矩阵相应元素应设为权重值。Prim's algorithm见Prim's Algorithm实现:void Gra原创 2017-07-17 11:55:02 · 854 阅读 · 0 评论