Exemple #1
0
func main() {
	var g *graph.DefaultGraph
	g, _ = utils.ReadFileToGraph("topology.txt")
	g = utils.ReadFile("topology.txt")
	fmt.Print(g.String())

	labels := utils.GetLabelList(g)
	fmt.Println(labels)

	neighbors, _ := utils.GetNeighborMap(g)
	fmt.Println(neighbors)
}
Exemple #2
0
func main() {
	g := utils.ReadFile("topology.txt")
	start := g.GetAllNodes()[0]
	sg, err := g.Search(start, func(edge *network.DsEdge) int { return edge.GetAttr("cost").(int) })
	sg.ToDot()
	fmt.Println(g.ToDot())
	//fmt.Printf("(%p)\n", g);
	//fmt.Println(start);
	//fmt.Printf("(%p of %p)\n", start, start.GetGraph());
	if err == nil {
		//fmt.Println(sg.ToDot());
	} else {
		//fmt.Println("Error: ", err);
	}
}