Graph-Layout-Aesthetic

 view release on metacpan or  search on metacpan

lib/Graph/Layout/Aesthetic/Topology.pm  view on Meta::CPAN

constructor.

=item X<add_edge>$topology->add_edge($from, $to ?,$forward?)

Register an edge running from vertex $from to vertex $to if $forward is not
given or true, a vertex from $to to $from otherwise. You can only add edges
as long as the topology is L<unfinished|"finish">.

It's possible to add an edge more than once or both in the forward and 
backward direction. All of these will be seen as different edges and be used
as such in the aesthetic force calculations.

=item X<finish>$topology->finish

Finishing a Graph::Layout::Aesthetic::Topology object makes it conceptually
read-only. You won't be able to L<add edges|"add_edge"> anymore.
L<Graph::Layout::Aesthetic|Graph::Layout::Aesthetic> constructors will only
accept finished Graph::Layout::Aesthetic::Topology objects since they may
internally cache information based on the topology of a given moment, and they
don't want that cached information to suddenly become invalid because the
topology got changed.

You can only finish a Graph::Layout::Aesthetic::Topology object once.

=item X<nr_vertices>$nr_vertices = $topology->nr_vertices

Returns the number of vertices in $topology.

=item X<neighbors>@vertices = $topology->neighbors($vertex)

Returns all direct neighbors of $vertex, following edges in any direction.

=item X<forward_neighbors>@vertices = $topology->forward_neighbors($vertex)

Returns all direct neighbors of $vertex, following edges in the forward
direction only.

=item X<edges>@edges = $topology->edges

Returns all forward edges in $topology as a list of anonymous array references.
Each such reference is to a two element array containing the $from and $to
vertex for that edge.

=item X<levels>@vertex_levels = $topology->levels

Returns a level number for each vertex (list element n represents the level
of vertex n). Levels basically correspond to distance from leafs (only 
following edges in the forward direction). These levels are used by some forces
like L<Graph::Layout::Aesthetic::Force::MinLevelVariance|Graph::Layout::Aesthetic::Force::MinLevelVariance>.

Levels are only calculated once for a given topology and then cached. The call
will croak if the $topology hasn't been L<finished|"finish"> yet.

=item X<finished>$boolean = $topology->finished

Returns true if $topology has been L<finished|"finish">, false otherwise.

=item X<private_data>$old_private_data = $topology->_private_data

Every topology object is associated with one scalar of private data (default
undef). This is perl data meant for the implementer of a Topology class, and 
should normally not be manipulated by the user (see
L<user_data|"user_data"> for that).

This method returns that private data.

=item $old_private_data = $topology->_private_data($new_private_data)

Sets new private data, returns the old value.

=item X<user_data>$old_user_data = $topology->user_data

Every topology object is associated with one scalar of user data (default
undef). This is perl data meant for the enduser of a topology class,
and should normally not be manipulated inside the topology class
(see L<private_data|"private_data"> for that).

This method returns that user data.

=item $old_user_data = $topology->user_data($new_user_data)

Sets new user data, returns the old value.

=back

=head1 EXPORT

None.

=head1 SEE ALSO

L<Graph>,
L<Graph::Layout::Aesthetic>

=head1 BUGS

Not threadsafe. Different object may have method calls going on at the same 
time, but any specific object should only have at most one call active.

=head1 AUTHOR

Ton Hospel, E<lt>Graph-Layout-Aesthetic@ton.iguana.beE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2004 by Ton Hospel

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.6.1 or,
at your option, any later version of Perl 5 you may have available.

=cut



( run in 3.809 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )