Skip to content

Simple graph lib with API to find path between two edges (does not have to be optimal)

Notifications You must be signed in to change notification settings

laplasianin/simple-graph-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple graph lib providing API to find path between two edges (does not have to be optimal).

Undirected and directed graphs are supported.

Edges are parametrized type so you can use any (but it should be comparable because it's used in algorythm).

Usage example:

Create undirected:
Graph graph = new BasicGraph<>();

Create directed:
Graph graph = new BasicGraph<>(Direction.Directed);

Add vertex:
graph.addVertex("vertex1");
graph.addVertex("vertex2");

Add edge between two vertices:
graph.addEdge("vertex1", "vertex2");
Beware that if graph is undirected you don't need to add vers edge (vertex2 -> vertex1), it's added internally.
Can throw NoSuchVertexException if you try to add invalid vertex.
Null vertices are not supported

Search path between two vertices:
Path path = GraphPathSearcher.getPath(graph, "vertex1", "vertex2");

About

Simple graph lib with API to find path between two edges (does not have to be optimal)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages