.NET Graph Libraryhttp://graphlib.codeplex.com/project/feeds/rssThe .Net Graph Library makes it easy for developers to create, traverse, analyze and solve problems related to graphs. Source code checked in, #96133http://graphlib.codeplex.com/SourceControl/changeset/changes/96133Upgrade: New Version of LabDefaultTemplate.xaml. To upgrade your build definitions, please visit the following link: http://go.microsoft.com/fwlink/?LinkId=254563Project Collection Service AccountsMon, 01 Oct 2012 21:40:31 GMTSource code checked in, #96133 20121001094031PSource code checked in, #96132http://graphlib.codeplex.com/SourceControl/changeset/changes/96132Checked in by server upgradeProject Collection Service AccountsMon, 01 Oct 2012 21:33:03 GMTSource code checked in, #96132 20121001093303PSource code checked in, #63489http://graphlib.codeplex.com/SourceControl/changeset/changes/63489Checked in by server upgrade_TFSSERVICETue, 27 Jul 2010 20:28:19 GMTSource code checked in, #63489 20100727082819PUpdated Wiki: Documentationhttp://graphlib.codeplex.com/documentation?version=7<div class="wikidoc"><b>Get Started</b>
<ol><li> Download the GraphLibrary.dll from the Downloads section.</li>
<li> Add GraphLibrary.dll as a reference to your .NET project.</li>
<li> Add a using GraphLibrary reference in your source code.</li></ol>
<br /><b>Creating and using a graph</b><br />A project goal was to make graph creation easy. No matter what type of graph you want (directed, undirected) you will always work with the IGraph<T,U> interface for your graph operations. The code below shows the basic<br />operations of the graph library.<br /><br /><pre>
//Creates an undirected graph with integer vertex data and double edge data
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//Create two stand-alone vertices
IVertexId id1 = graph.AddVertex(1); id1.FriendlyName = "First Vertex";
IVertexId id2 = graph.AddVertex(2); id2.FriendlyName = "Second Vertex";
//Create an edge and access the IVertexids from the IEdgeId.
IEdgeId eid1 = graph.AddVertices(3.0, 3, 4);
IVertexId id3 = eid1.VertexId1; id3.FriendlyName = "Third Vertex";
IVertexId id4 = eid1.VertexId2; id4.FriendlyName = "Fourth Vertex";
//Create an edge between two existing vertices.
IEdgeId eid2 = graph.AddEdge(4.0, id1, id2);
</pre><br /><br />The key to using the graph library lies in the IVertexId and IEdgeId interfaces. In order to access a vertex (or edge) you must provide the graph with an IVertexId that the graph provided either from adding a vertex or adding an edge. The ids generated are unique to the graph, meaning that no two vertices will have the same IVertexId, even if they have the same vertex data value. See the code below:<br /><pre>
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//These are two different vertices even though they have the same vertex data value.
IVertexId id1 = graph.AddVertex(1);
IVertexId id2 = graph.AddVertex(1);
</pre><br />Now suppose you wanted to update the vertex with data value 1, you'll need to specify a particular IVertexId. The graph.ReplaceVertex(..) method replaces the vertex data based on an existing IVertexId to ensure that the right vertex is being changed.<br /><pre>
int vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
int vertexData2 = graph.GetVertexData(id2); //vertexData2 = 1
if(graph.ReplaceVertex(id2))
{
vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
vertexData2 = graph.GetVertexData(id2); //vertexData2 = 2
}
</pre><br /><br /><b>Note about IVertexId and IEdgeId </b><br />Important note about the FriendlyName property. It means nothing to the graph and cannot be used to find a vertex in the graph. It is useful for storing the IDs in a data structure such as a dictionary for easy<br />retrieval. Setting the property is a local change since you receive a copy of the IVertexId or IEdgeId used by the graph.<br /><br />Do <b>NOT</b> set a returned IVertexId or IEdgeId to null. Doing so will cause you to lose access to that vertex or edge. The vertex or edge will still exist in the graph, but you will not be able to replace its data. You'll only see the data during graph traversal. A future release may include a recovery method for retrieving lost ids.<br /><br /><b>Graph Traversal</b><br />Use the IGraphTraverser<T,U> interface to traverse a graph. Here is an example using the depth first traverser<br /><br /><pre>
IGraph<int, int> graph = GraphFactory<int, int>.CreateGraph(GraphTypes.Undirected);
IVertexId v1 = graph.AddVertex(1);
IVertexId v2 = graph.AddVertex(2);
IVertexId v3 = graph.AddVertex(3);
IVertexId v4 = graph.AddVertex(4);
IVertexId v5 = graph.AddVertex(5);
IEdgeId v1Tov2 = graph.AddEdge(1, v1, v2);
IEdgeId v2Tov4 = graph.AddEdge(2, v2, v4);
IEdgeId v2Tov3 = graph.AddEdge(3, v2, v3);
IEdgeId v1Tov3 = graph.AddEdge(4, v1, v3);
IEdgeId v3Tov4 = graph.AddEdge(5, v3, v4);
IEdgeId v3Tov5 = graph.AddEdge(6, v3, v5);
IGraphTraverser<int, int> traverser = new DepthFirstTraverser<int, int>();
traverser.Graph = graph;
IList<int> results = traverser.Traverse(v1);
foreach(int i in results)
{
Console.Write( "{0} ", i);
}
//output will be 1 3 5 4 2
</pre><br />To use, just create your graph and create a Traverser. Set the Traverser.Graph property to your graph and then traverse using a starting vertex.<br /> </div><div class="ClearBoth"></div>gavinmeadWed, 13 Jan 2010 18:29:24 GMTUpdated Wiki: Documentation 20100113062924PUpdated Wiki: Documentationhttp://graphlib.codeplex.com/documentation?version=6<div class="wikidoc"><b>Get Started</b>
<ol><li> Download the GraphLibrary.dll from the Downloads section.</li>
<li> Add GraphLibrary.dll as a reference to your .NET project.</li>
<li> Add a using GraphLibrary reference in your source code.</li></ol>
<br /><b>Creating and using a graph</b><br />A project goal was to make graph creation easy. No matter what type of graph you want (directed, undirected) you will always work with the IGraph<T,U> interface for your graph operations. The code below shows the basic<br />operations of the graph library.<br /><br /><pre>
//Creates an undirected graph with integer vertex data and double edge data
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//Create two stand-alone vertices
IVertexId id1 = graph.AddVertex(1); id1.FriendlyName = "First Vertex";
IVertexId id2 = graph.AddVertex(2); id2.FriendlyName = "Second Vertex";
//Create an edge and access the IVertexids from the IEdgeId.
IEdgeId eid1 = graph.AddVertices(3.0, 3, 4);
IVertexId id3 = eid1.VertexId1; id3.FriendlyName = "Third Vertex";
IVertexId id4 = eid1.VertexId2; id4.FriendlyName = "Fourth Vertex";
//Create an edge between two existing vertices.
IEdgeId eid2 = graph.AddEdge(4.0, id1, id2);
</pre><br /><br />The key to using the graph library lies in the IVertexId and IEdgeId interfaces. In order to access a vertex (or edge) you must provide the graph with an IVertexId that the graph provided either from adding a vertex or adding an edge. The ids generated are unique to the graph, meaning that no two vertices will have the same IVertexId, even if they have the same vertex data value. See the code below:<br /><pre>
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//These are two different vertices even though they have the same vertex data value.
IVertexId id1 = graph.AddVertex(1);
IVertexId id2 = graph.AddVertex(1);
</pre><br />Now suppose you wanted to update the vertex with data value 1, you'll need to specify the a particular IVertexId. The graph.ReplaceVertex(..) method replaces the vertex data based on an existing IVertexId to ensure that the right vertex is being changed.<br /><pre>
int vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
int vertexData2 = graph.GetVertexData(id2); //vertexData2 = 1
if(graph.ReplaceVertex(id2))
{
vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
vertexData2 = graph.GetVertexData(id2); //vertexData2 = 2
}
</pre><br /><br /><b>Note about IVertexId and IEdgeId </b><br />Important note about the FriendlyName property. It means nothing to the graph and cannot be used to find a vertex in the graph. It is useful for storing the IDs in a data structure such as a dictionary for easy<br />retrieval. Setting the property is a local change since you receive a copy of the IVertexId or IEdgeId used by the graph.<br /><br />Do <b>NOT</b> set a returned IVertexId or IEdgeId to null. Doing so will cause you to lose access to that vertex or edge. The vertex or edge will still exist in the graph, but you will not be able to replace its data. You'll only see the data during graph traversal. A future release may include a recovery method for retrieving lost ids.<br /><br /><b>Graph Traversal</b><br />Use the IGraphTraverser<T,U> interface to traverse a graph. Here is an example using the depth first traverser<br /><br /><pre>
IGraph<int, int> graph = GraphFactory<int, int>.CreateGraph(GraphTypes.Undirected);
IVertexId v1 = graph.AddVertex(1);
IVertexId v2 = graph.AddVertex(2);
IVertexId v3 = graph.AddVertex(3);
IVertexId v4 = graph.AddVertex(4);
IVertexId v5 = graph.AddVertex(5);
IEdgeId v1Tov2 = graph.AddEdge(1, v1, v2);
IEdgeId v2Tov4 = graph.AddEdge(2, v2, v4);
IEdgeId v2Tov3 = graph.AddEdge(3, v2, v3);
IEdgeId v1Tov3 = graph.AddEdge(4, v1, v3);
IEdgeId v3Tov4 = graph.AddEdge(5, v3, v4);
IEdgeId v3Tov5 = graph.AddEdge(6, v3, v5);
IGraphTraverser<int, int> traverser = new DepthFirstTraverser<int, int>();
traverser.Graph = graph;
IList<int> results = traverser.Traverse(v1);
foreach(int i in results)
{
Console.Write( "{0} ", i);
}
//output will be 1 3 5 4 2
</pre><br />To use, just create your graph and create a Traverser. Set the Traverser.Graph property to your graph and then traverse using a starting vertex.<br /> </div><div class="ClearBoth"></div>gavinmeadThu, 07 Jan 2010 19:26:44 GMTUpdated Wiki: Documentation 20100107072644PUpdated Release: Graph Library (Jan 06, 2010)http://graphlib.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=38344<div class="wikidoc">Download a release to use in your projects.</div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 21:46:33 GMTUpdated Release: Graph Library (Jan 06, 2010) 20100106094633PReleased: Graph Library (Jan 06, 2010)http://graphlib.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=38344<div>Download a release to use in your projects.</div><div></div>Wed, 06 Jan 2010 21:46:33 GMTReleased: Graph Library (Jan 06, 2010) 20100106094633PUpdated Release: Graph Library (Jan 06, 2010)http://graphlib.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=38344<div class="wikidoc">Download a release to use in your projects.</div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 21:36:48 GMTUpdated Release: Graph Library (Jan 06, 2010) 20100106093648PUpdated Release: Graph Library (Jan 04, 2010)http://graphlib.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=38344<div class="wikidoc">Download a release to use in your projects.</div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 21:36:12 GMTUpdated Release: Graph Library (Jan 04, 2010) 20100106093612PUpdated Wiki: Documentationhttp://graphlib.codeplex.com/documentation?version=5<div class="wikidoc"><b>Get Started</b>
<ol><li> Download the GraphLibrary.dll from the Downloads section.</li>
<li> Add GraphLibrary.dll as a reference to your .NET project.</li>
<li> Add a using GraphLibrary reference in your source code.</li></ol>
<br /><b>Creating and using a graph</b><br />A project goal was to make graph creation easy. No matter what type of graph you want (directed, undirected) you will always work with the IGraph<T,U> interface for your graph operations. The code below shows the basic<br />operations of the graph library.<br /><br /><pre>
//Creates an undirected graph with integer vertex data and double edge data
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//Create two stand-alone vertices
IVertexId id1 = graph.AddVertex(1); id1.FriendlyName = "First Vertex";
IVertexId id2 = graph.AddVertex(2); id2.FriendlyName = "Second Vertex";
//Create an edge and access the IVertexids from the IEdgeId.
IEdgeId eid1 = graph.AddVertices(3.0, 3, 4);
IVertexId id3 = eid1.VertexId1; id3.FriendlyName = "Third Vertex";
IVertexId id4 = eid1.VertexId2; id4.FriendlyName = "Fourth Vertex";
//Create an edge between two existing vertices.
IEdgeId eid2 = graph.AddEdge(4.0, id1, id2);
</pre><br /><br />The key to using the graph library lies in the IVertexId and IEdgeId interfaces. In order to access a vertex (or edge) you must provide the graph with an IVertexId that the graph provided either from adding a vertex or adding an edge. The ids generated are unique to the graph, meaning that no two vertices will have the same IVertexId, even if they have the same vertex data value. See the code below:<br /><pre>
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//These are two different vertices even though they have the same vertex data value.
IVertexId id1 = graph.AddVertex(1);
IVertexId id2 = graph.AddVertex(1);
</pre><br />Now suppose you wanted to update the vertex with data value 1. The graph.ReplaceVertex(..) method replaces the vertex data based on an existing IVertexId to ensure that the right vertex is being changed.<br /><pre>
int vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
int vertexData2 = graph.GetVertexData(id2); //vertexData2 = 1
if(graph.ReplaceVertex(id2))
{
vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
vertexData2 = graph.GetVertexData(id2); //vertexData2 = 2
}
</pre><br /><br /><b>Note about IVertexId and IEdgeId </b><br />Important note about the FriendlyName property. It means nothing to the graph and cannot be used to find a vertex in the graph. It is useful for storing the IDs in a data structure such as a dictionary for easy<br />retrieval. Setting the property is a local change since you receive a copy of the IVertexId or IEdgeId used by the graph.<br /><br />Do <b>NOT</b> set a returned IVertexId or IEdgeId to null. Doing so will cause you to lose access to that vertex or edge. The vertex or edge will still exist in the graph, but you will not be able to replace its data. You'll only see the data during graph traversal. A future release may include a recovery method for retrieving lost ids.<br /><br /><b>Graph Traversal</b><br />Use the IGraphTraverser<T,U> interface to traverse a graph. Here is an example using the depth first traverser<br /><br /><pre>
IGraph<int, int> graph = GraphFactory<int, int>.CreateGraph(GraphTypes.Undirected);
IVertexId v1 = graph.AddVertex(1);
IVertexId v2 = graph.AddVertex(2);
IVertexId v3 = graph.AddVertex(3);
IVertexId v4 = graph.AddVertex(4);
IVertexId v5 = graph.AddVertex(5);
IEdgeId v1Tov2 = graph.AddEdge(1, v1, v2);
IEdgeId v2Tov4 = graph.AddEdge(2, v2, v4);
IEdgeId v2Tov3 = graph.AddEdge(3, v2, v3);
IEdgeId v1Tov3 = graph.AddEdge(4, v1, v3);
IEdgeId v3Tov4 = graph.AddEdge(5, v3, v4);
IEdgeId v3Tov5 = graph.AddEdge(6, v3, v5);
IGraphTraverser<int, int> traverser = new DepthFirstTraverser<int, int>();
traverser.Graph = graph;
IList<int> results = traverser.Traverse(v1);
foreach(int i in results)
{
Console.Write( "{0} ", i);
}
//output will be 1 3 5 4 2
</pre><br />To use, just create your graph and create a Traverser. Set the Traverser.Graph property to your graph and then traverse using a starting vertex.<br /> </div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 21:31:40 GMTUpdated Wiki: Documentation 20100106093140PCreated Release: Graph Library (Dec 24, 2009)http://graphlib.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=38344<div class="wikidoc">Download a release to use in your projects.</div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 21:27:36 GMTCreated Release: Graph Library (Dec 24, 2009) 20100106092736PUpdated Wiki: Documentationhttp://graphlib.codeplex.com/documentation?version=4<div class="wikidoc"><b>Get Started</b>
<ol><li> Download the GraphLibrary.dll from the Downloads section.</li>
<li> Add GraphLibrary.dll as a reference to your .NET project.</li></ol>
<br /><b>Creating and using a graph</b><br />A project goal was to make graph creation easy. No matter what type of graph you want (directed, undirected) you will always work with the IGraph<T,U> interface for your graph operations. The code below shows the basic<br />operations of the graph library.<br /><br /><pre>
//Creates an undirected graph with integer vertex data and double edge data
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//Create two stand-alone vertices
IVertexId id1 = graph.AddVertex(1); id1.FriendlyName = "First Vertex";
IVertexId id2 = graph.AddVertex(2); id2.FriendlyName = "Second Vertex";
//Create an edge and access the IVertexids from the IEdgeId.
IEdgeId eid1 = graph.AddVertices(3.0, 3, 4);
IVertexId id3 = eid1.VertexId1; id3.FriendlyName = "Third Vertex";
IVertexId id4 = eid1.VertexId2; id4.FriendlyName = "Fourth Vertex";
//Create an edge between two existing vertices.
IEdgeId eid2 = graph.AddEdge(4.0, id1, id2);
</pre><br /><br />The key to using the graph library lies in the IVertexId and IEdgeId interfaces. In order to access a vertex (or edge) you must provide the graph with an IVertexId that the graph provided either from adding a vertex or adding an edge. The ids generated are unique to the graph, meaning that no two vertices will have the same IVertexId, even if they have the same vertex data value. See the code below:<br /><pre>
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//These are two different vertices even though they have the same vertex data value.
IVertexId id1 = graph.AddVertex(1);
IVertexId id2 = graph.AddVertex(1);
</pre><br />Now suppose you wanted to update the vertex with data value 1. The graph.ReplaceVertex(..) method replaces the vertex data based on an existing IVertexId to ensure that the right vertex is being changed.<br /><pre>
int vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
int vertexData2 = graph.GetVertexData(id2); //vertexData2 = 1
if(graph.ReplaceVertex(id2))
{
vertexData1 = graph.GetVertexData(id1); //vertexData1 = 1
vertexData2 = graph.GetVertexData(id2); //vertexData2 = 2
}
</pre><br /><br /><b>Note about IVertexId and IEdgeId </b><br />Important note about the FriendlyName property. It means nothing to the graph and cannot be used to find a vertex in the graph. It is useful for storing the IDs in a data structure such as a dictionary for easy<br />retrieval. Setting the property is a local change since you receive a copy of the IVertexId or IEdgeId used by the graph.<br /><br />Do <b>NOT</b> set a returned IVertexId or IEdgeId to null. Doing so will cause you to lose access to that vertex or edge. The vertex or edge will still exist in the graph, but you will not be able to replace its data. You'll only see the data during graph traversal. A future release may include a recovery method for retrieving lost ids.<br /><br /><b>Graph Traversal</b><br />Use the IGraphTraverser<T,U> interface to traverse a graph. Here is an example using the depth first traverser<br /><br /><pre>
IGraph<int, int> graph = GraphFactory<int, int>.CreateGraph(GraphTypes.Undirected);
IVertexId v1 = graph.AddVertex(1);
IVertexId v2 = graph.AddVertex(2);
IVertexId v3 = graph.AddVertex(3);
IVertexId v4 = graph.AddVertex(4);
IVertexId v5 = graph.AddVertex(5);
IEdgeId v1Tov2 = graph.AddEdge(1, v1, v2);
IEdgeId v2Tov4 = graph.AddEdge(2, v2, v4);
IEdgeId v2Tov3 = graph.AddEdge(3, v2, v3);
IEdgeId v1Tov3 = graph.AddEdge(4, v1, v3);
IEdgeId v3Tov4 = graph.AddEdge(5, v3, v4);
IEdgeId v3Tov5 = graph.AddEdge(6, v3, v5);
IGraphTraverser<int, int> traverser = new DepthFirstTraverser<int, int>();
traverser.Graph = graph;
IList<int> results = traverser.Traverse(v1);
foreach(int i in results)
{
Console.Write( "{0} ", i);
}
//output will be 1 3 5 4 2
</pre><br />To use, just create your graph and create a Traverser. Set the Traverser.Graph property to your graph and then traverse using a starting vertex.<br /> </div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 21:23:26 GMTUpdated Wiki: Documentation 20100106092326PUpdated Wiki: Documentationhttp://graphlib.codeplex.com/documentation?version=3<div class="wikidoc"><b>Get Started</b>
<ol><li> Download the GraphLib.dll from the Downloads section.</li>
<li> Add GraphLib.dll as a reference to your .NET project.</li></ol>
<br /><b>Creating and using a graph</b><br />A project goal was to make graph creation easy. No matter what type of graph you want (directed, undirected) you'll always work the IGraph<T,U> interface for your graph operations. The code below shows the basic<br />operations of the graph library.<br /><br /><pre>
//Creates an undirected graph with integer vertex data and double edge data
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//Create two stand-alone vertices
IVertexId id1 = graph.AddVertex(1); id1.FriendlyName = "First Vertex";
IVertexId id2 = graph.AddVertex(2); id2.FriendlyName = "Second Vertex";
//Create an edge and access the IVertexid's from the IEdgeId.
IEdgeId eid1 = graph.AddVertices(3.0, 3, 4);
IVertexId id3 = eid1.VertexId1; id3.FriendlyName = "Third Vertex";
IVertexId id4 = eid1.VertexId2; id4.FriendlyName = "Fourth Vertex";
//Create an edge between two existing vertices.
IEdgeId eid2 = graph.AddEdge(4.0, id1, id2);
</pre><br /><br />The key to using the graph library lies in the IVertexId and IEdgeId interfaces. In order to access a vertex you must provide the graph with an IVertexId that the graph provided either from adding a vertex or adding an edge. The ids generated are unique to the graph, meaning that no two vertices will have the same IVertexId, even if they have the same vertex data value. See the code below:<br /><pre>
//...graph has been created.
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//These are two difference vertices even though they have the same vertex data value.
IVertexId id1 = graph.AddVertex(1);
IVertexId id2 = graph.AddVertex(1);
</pre><br />Now suppose you wanted to update the vertex with data value 1. The graph.ReplaceVertex(..) method replaces the vertex data based on an existing IVertexId to ensure that the right vertex is being changed.<br /><pre>
int vertexData = graph.GetVertexData(id2); //vertexData = 1
if(graph.ReplaceVertex(id2))
{
int vertexData = graph.GetVertexData(id2); //vertexData = 2
}
</pre><br /><br /><b>Notes about IVertexId and IEdgeId </b><br />Important notes about the FriendlyName property. It means nothing to the graph and cannot be used to find a vertex in the graph. It is useful for storing the IDs in a data structure such as a dictionary for easy<br />retrieval. Setting the property is a local change since you receive a copy of the IVertexId or IEdgeId used by the graph.<br /><br />Do <b>NOT</b> set a returned IVertexId or IEdgeId to null. Doing so will cause you to lose access to that vertex or edge. The vertex or edge will still exist in the graph, but you will not be able to replace its data. You'll only see the data during graph traversal. A future release may include a recovery method for retrieving lost ids.<br /><br /><b>Graph Traversal</b><br />Use the IGraphTraverser<T,U> interface to traverse a graph. Here is an example using the depth first traverser<br /><br /><pre>
IGraph<int, int> graph = GraphFactory<int, int>.CreateGraph(GraphTypes.Undirected);
IVertexId v1 = graph.AddVertex(1);
IVertexId v2 = graph.AddVertex(2);
IVertexId v3 = graph.AddVertex(3);
IVertexId v4 = graph.AddVertex(4);
IVertexId v5 = graph.AddVertex(5);
IEdgeId v1Tov2 = graph.AddEdge(1, v1, v2);
IEdgeId v2Tov4 = graph.AddEdge(2, v2, v4);
IEdgeId v2Tov3 = graph.AddEdge(3, v2, v3);
IEdgeId v1Tov3 = graph.AddEdge(4, v1, v3);
IEdgeId v3Tov4 = graph.AddEdge(5, v3, v4);
IEdgeId v3Tov5 = graph.AddEdge(6, v3, v5);
IGraphTraverser<int, int> traverser = new DepthFirstTraverser<int, int>();
traverser.Graph = graph;
IList<int> results = traverser.Traverse(v1);
foreach(int i in results)
{
Console.Write( "{0} ", i);
}
//output will be 1 3 5 4 2
</pre><br />To use, just create your graph and create a Traverser. Set the Traverser.Graph property to your graph and then traverse using a starting vertex.<br /> </div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 21:16:30 GMTUpdated Wiki: Documentation 20100106091630PUpdated Wiki: Documentationhttp://graphlib.codeplex.com/documentation?version=2<div class="wikidoc"><b>Get Started</b>
<ol><li> Download the GraphLib.dll from the Downloads section.</li>
<li> Add GraphLib.dll as a reference to your .NET project.</li></ol>
<br /><b>Creating and using a graph</b><br />A project goal was to make graph creation easy. No matter what type of graph you want (directed, undirected) you'll always work the IGraph<T,U> interface for your graph operations. The code below shows the basic<br />operations of the graph library.<br /><br /><pre>
//Creates an undirected graph with integer vertex data and double edge data
IGraph<int, double> graph = GraphFactory.CreateGraph<int,double>(GraphTypes.Undirected);
//Create two stand-alone vertices
IVertexId id1 = graph.AddVertex(1); id1.FriendlyName = "First Vertex";
IVertexId id2 = graph.AddVertex(2); id2.FriendlyName = "Second Vertex";
//Create an edge and access the IVertexid's from the IEdgeId.
IEdgeId eid1 = graph.AddVertices(3.0, 3, 4);
IVertexId id3 = eid1.VertexId1; id3.FriendlyName = "Third Vertex";
IVertexId id4 = eid1.VertexId2; id4.FriendlyName = "Fourth Vertex";
//Create an edge between two existing vertices.
IEdgeId eid2 = graph.AddEdge(4.0, id1, id2);
</pre></div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 20:49:34 GMTUpdated Wiki: Documentation 20100106084934PUpdated Wiki: Homehttp://graphlib.codeplex.com/wikipage?version=5<div class="wikidoc"><b>Project Description</b><br />The .Net Graph Library makes it easy for developers to create, traverse, analyze and solve problems related to graphs. <br /><br /><b>Current Release Features</b>
<ul><li>Create directed and undirected graphs.</li>
<li>DFS graph traversal</li></ul>
<br /><b>Next Release</b>
<ul><li>Join two graphs together</li>
<li>BFS graph traversals</li>
<li>Weighted graphs</li>
<li>SPF implementation</li></ul>
<br /><b>Getting Started</b><br />Check out the documentation for some quick tutorials on the key features of the library.<br /></div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 20:35:11 GMTUpdated Wiki: Home 20100106083511PUpdated Wiki: Documentationhttp://graphlib.codeplex.com/documentation?version=1<div class="wikidoc"><b>Get Started</b>
<ol><li> Download the GraphLib.dll from the Downloads section.</li>
<li> Add GraphLib.dll as a reference to your .NET project.</li></ol>
<br /><b>Creating a graph</b><br />A project goal was to make graph creation easy. No matter what type of graph you want (directed, undirected) you'll always work the IGraph<T,U> interface for your graph operations.</div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 20:34:43 GMTUpdated Wiki: Documentation 20100106083443PUpdated Wiki: Homehttp://graphlib.codeplex.com/wikipage?version=4<div class="wikidoc"><b>Project Description</b><br />The .Net Graph Library makes it easy for developers to create, traverse, analyze and solve problems related to graphs. <br /><br /><b>Current Release Features</b>
<ul><li>Create directed and undirected graphs.</li>
<li>DFS graph traversal</li></ul>
<br /><b>Next Release</b>
<ul><li>BFS graph traversals</li>
<li>Weighted graphs</li>
<li>SPF implementation</li></ul>
<br /><b>Getting Started</b><br />Check out the documentation for some quick tutorials on the key features of the library.<br /></div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 20:27:45 GMTUpdated Wiki: Home 20100106082745PUpdated Wiki: Homehttp://graphlib.codeplex.com/wikipage?version=3<div class="wikidoc"><b>Project Description</b><br />The .Net Graph Library makes it easy for developers to create, traverse, analyze and solve problems related to graphs. <br /><br /><b>Current Release Features</b>
<ul><li>Create directed and undirected graphs.</li>
<li>DFS graph traversal</li></ul>
<br /><b>Next Release</b>
<ul><li>BFS graph traversals</li>
<li>Weighted graphs.</li>
<li>SPF implementation</li></ul>
<br /><b>Getting Started</b><br />Check out the documentation for some quick tutorials on the key features of the library.<br /></div><div class="ClearBoth"></div>gavinmeadWed, 06 Jan 2010 20:27:30 GMTUpdated Wiki: Home 20100106082730PSource code checked in, #49732http://graphlib.codeplex.com/SourceControl/changeset/view/49732Fixed UndirectedGraphTests.cs SVN problem.gavinmeadWed, 02 Dec 2009 02:35:46 GMTSource code checked in, #49732 20091202023546ASource code checked in, #49731http://graphlib.codeplex.com/SourceControl/changeset/view/49731gavinmeadWed, 02 Dec 2009 02:35:23 GMTSource code checked in, #49731 20091202023523A