Graph::Weighted is an abstract, weighted graph implementation.
SYNOPSIS
use Graph::Weighted;
$g = Graph::Weighted->new(
data => [
[ 0, 1, 2, 0, 0 ], # A vertex with two edges.
[ 1, 0, 3, 0, 0 ], # "
[ 2, 3, 0, 0, 0 ], # "
[ 0, 0, 1, 0, 0 ], # A vertex with one edge.
[ 0, 0, 0, 0, 0 ] # A vertex with no edges.
]
);
$g = Graph::Weighted->new(
data => {
weight => {
a => { b => 1, c => 2 }, # A vertex with two edges.
b => { a => 1, c => 3 }, # "
c => { a => 2, b => 3 }, # "
d => { c => 1 }, # A vertex with one edge.
e => {} # A vertex with no edges.
}
foo => [
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
],
}
);
$g = Graph::Weighted->new(
data => $Math_Matrix_object,
retrieve_as => 'ARRAY',
);
$data = $g->weight_data;
$w = $g->graph_weight;
$w = $g->vertex_weight($v1);
$w = $g->vertex_weight($v1, $w + 1);
$w = $g->edge_weight($v1, $v2);
$w = $g->edge_weight($v1, $v2, $w + 1);
$vertices = $g->heaviest_vertices;
$vertices = $g->lightest_vertices;
$w = $g->max_weight; # Weight of the largest vertices.
$w = $g->min_weight; # Weight of the smallest vertices.
# Call the weight methods of the inherited Graph module.
$x = $g->MST_Kruskal;
$x = $g->APSP_Floyd_Warshall;
$x = $g->MST_Prim($p);
Requirements:
· Perl
Product's homepage