Undirected Graph shortest path problem

Jan 26, 2009 at 11:53 AM
Hi,
i have this sample code:

UndirectedGraph

 

<object, Edge<object>> ug =

 

 

new UndirectedGraph<object, Edge<object>>(true);

 

 

object v1 = "vertex1";

 

 

object v2 = "vertex2";

 

 

object v3 = "vertex3";

 

 

Edge<object> e1 = new Edge<object>(v1, v2);

 

 

Edge<object> e2 = new Edge<object>(v2, v3);

 

 

Edge<object> e3 = new Edge<object>(v3, v1);

 

ug.AddVertex(v1);

ug.AddVertex(v2);

ug.AddVertex(v3);

ug.AddEdge(e1);

ug.AddEdge(e2);

ug.AddEdge(e3);

QuickGraph.Algorithms.ShortestPath.

UndirectedDijkstraShortestPathAlgorithm<object, QuickGraph.Edge<object>> udspa =

 

 

new QuickGraph.Algorithms.ShortestPath.UndirectedDijkstraShortestPathAlgorithm<object, QuickGraph.Edge<object>>(ug, edge => (double)1);

 

QuickGraph.Algorithms.Observers.

UndirectedVertexPredecessorRecorderObserver<object, Edge<object>> observer =

 

 

new QuickGraph.Algorithms.Observers.UndirectedVertexPredecessorRecorderObserver<object, Edge<object>>();

 

observer.Attach(udspa);

udspa.Compute(v1);

 

IEnumerable<QuickGraph.Edge<object>> path;

 

observer.TryGetPath(v3,

out path);


and i get out of memory exception. what am i doing wrong?


tnx,
Alfred.

 

Coordinator
Jan 26, 2009 at 3:13 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.