NAME
Graph::Fast - graph data structures and algorithms, just faster.
SYNOPSIS
# todo
DESCRIPTION
Graph::Fast implements a mathematical abstract data structure, called graph, that models relations between objects with vertices and edges.
Graph::Fast vs Graph
While Graph is a module with a lot of features, it is not really fast. Graph::Fast doesn't implement all the features, but it is much faster. Graph::Fast is for you if you need the most important things done very fast.
FUNCTIONS
Available functions are:
new(optional options...)
Constructs a new Graph::Fast object.
The constructor takes optional parameters as a hash. Currently there are no options.
count_edges()
Returns the number of edges in the graph.
count_vertices()
Returns the number of vertices in the graph.
add_vertex($name)
Adds a vertex with the specified name to the graph. Names must be unique. It is safe to call this with a name that already exists in the graph.
add_edge($from => $to, $weight, $user_data)
Adds a directed edge to the graph, pointing from vertex named $from to $to. The edge has a weight of $weight. Application-specific data can be added to the edge.
del_edge($from => $to)
Removes an edge that points from named vertex $from to $to from the graph.
It is safe to call this for edges that do not exist.
dijkstra($from => $to)
Invokes Dijkstra's algorithm on the graph to find the shortest path from source vertex $from to destination vertex $to.
If a path is found, it is returned as a list of edges. The edges are hashrefs with from, to, weight and possibly user_data keys. If no path is found, an empty list is returned.
LIMITATIONS
Many features are missing. This includes basic features.
Vertices currently cannot be deleted once added to the graph.
It is unclear how to deal with multiedges (two different edges that connect the same pair of vertices). The behaviour will likely change in the future. Currently edges can and will exist only once.
BUGS
Maybe.
SEE ALSO
Graph - slower, but a lot more features
Boost::Graph - faster, written in C++
AUTHORS & COPYRIGHTS
Made 2010 by Lars Stoltenow. This is free software; you may redistribute it and/or modify it under the same terms as Perl itself.