Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
README.md
pom.xml

README.md

Simple Graph Lib

Description

This tiny library supports both directed and undirected graphs with ability to use synchronized realizations of them.

Vertexes of the graph have a user defined type.

The calculation of the path was implemented with the usage of the Dijkstra's algorithm.

Usage

You should use GraphBuilder class for building you graph data.

String a = "a";
String b = "b";
String c = "c";
String d = "d";

Graph graph = GraphBuilder.create(Builder.Type.DIRECTED)
    .addVertex(a)
    .addVertex(b)
    .addVertex(c)
    .addEdge(a, b)
    .addEdge(b, c)
    .addEdge(c, d)
    .build();

List<String> path = graph.getPath(a, f);

addVertex - adds vertex to the graph

addEdge - adds edge to the graph

build - builds specific graph implementation.

getPath - returns a list of edges between 2 vertices

You can’t perform that action at this time.