Skip to content

arechesk/SimpleGraphLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Graph lib:

Build Status

Support 2 types of graphs - directed and undirected with 3 operations:

addVertex - adds vertex to the graph

   Vertex addVertex()

addEdge - adds edge to the graph

   void addEdge(Vertex source,Vertex target)

getPath - returns a list of edges between 2 vertices (path doesn’t have to be optimal)

   List<Edge> getPath(Vertex source, Vertex target) 

Example:

   Graph graph = new DirectedGraph();
   Vertex v1 = graph.addVertex();
   Vertex v2 = graph.addVertex();
   Vertex v3 = graph.addVertex();
   Vertex v4 = graph.addVertex();
   Vertex v5 = graph.addVertex();
   Vertex v6 = graph.addVertex();

   graph.addEdge(v1, v2);
   graph.addEdge(v1, v5);
   graph.addEdge(v1, v6);
   graph.addEdge(v2, v3);
   graph.addEdge(v2, v5);
   graph.addEdge(v3, v4);
   graph.addEdge(v5, v4);

   graph.getPath(v1,v4);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages