GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Graph::Easy::Group(3) User Contributed Perl Documentation Graph::Easy::Group(3)

Graph::Easy::Group - A group of nodes (aka subgraph) in Graph::Easy

        use Graph::Easy;

        my $bonn = Graph::Easy::Node->new('Bonn');

        $bonn->set_attribute('border', 'solid 1px black');

        my $berlin = Graph::Easy::Node->new( name => 'Berlin' );

        my $cities = Graph::Easy::Group->new(
                name => 'Cities',
        );
        $cities->set_attribute('border', 'dashed 1px blue');

        $cities->add_nodes ($bonn);
        # $bonn will be ONCE in the group
        $cities->add_nodes ($bonn, $berlin);

A "Graph::Easy::Group" represents a group of nodes in an "Graph::Easy" object. These nodes are grouped together on output.

        my $group = Graph::Easy::Group->new( $options );

Create a new, empty group. $options are the possible options, see Graph::Easy::Node for a list.

        $last_error = $group->error();

        $group->error($error);                  # set new messages
        $group->error('');                      # clear error

Returns the last error message, or '' for no error.

        my $ascii = $group->as_ascii();

Return the group as a little box drawn in ASCII art as a string.

        my $name = $group->name();

Return the name of the group.

        my $id = $group->id();

Returns the group's unique ID number.

        $group->set_attribute('border-style', 'none');

Sets the specified attribute of this (and only this!) group to the specified value.

        $group->add_member($node);
        $group->add_member($group);

Add the specified object to this group and returns this member. If the passed argument is a scalar, will treat it as a node name.

Note that each object can only be a member of one group at a time.

        $group->add_node($node);

Add the specified node to this group and returns this node.

Note that each object can only be a member of one group at a time.

        $group->add_edge($edge);                # Graph::Easy::Edge
        $group->add_edge($from, $to);           # Graph::Easy::Node or
                                                # Graph::Easy::Group
        $group->add_edge('From', 'To');         # Scalars

If passed an Graph::Easy::Edge object, moves the nodes involved in this edge to the group.

if passed two nodes, adds these nodes to the graph (unless they already exist) and adds an edge between these two nodes. See add_edge_once() to avoid creating multiple edges.

This method works only on groups that are part of a graph.

Note that each object can only be a member of one group at a time, and edges are automatically a member of a group if and only if both the target and the destination node are a member of the same group.

        my $inner = $group->add_group('Group name');
        my $nested = $group->add_group($group);

Add a group as subgroup to this group and returns this group.

        $group->del_member($node);
        $group->del_member($group);

Delete the specified object from this group.

        $group->del_node($node);

Delete the specified node from this group.

        $group->del_edge($edge);

Delete the specified edge from this group.

        $group->add_nodes($node, $node2, ... );

Add all the specified nodes to this group and returns them as a list.

        my @nodes = $group->nodes();

Returns a list of all node objects that belong to this group.

        my @edges = $group->edges();

Returns a list of all edge objects that lead to or from this group.

Note: This does not return edges between nodes that are inside the group, for this see edges_within().

        my @edges_within = $group->edges_within();

Returns a list of all edge objects that are inside this group, in arbitrary order. Edges are automatically considered inside a group if their starting and ending node both are in the same group.

Note: This does not return edges between this group and other groups, nor edges between this group and nodes outside this group, for this see edges().

        my @groups = $group->groups();

Returns the contained groups of this group as Graph::Easy::Group objects, in arbitrary order.

        # equivalent to $group->groups():
        my @groups = $group->groups_within();           # all
        my @toplevel_groups = $group->groups_within(0); # level 0 only

Return the groups that are inside this group, up to the specified level, in arbitrary order.

The default level is -1, indicating no bounds and thus all contained groups are returned.

A level of 0 means only the direct children, and hence only the toplevel groups will be returned. A level 1 means the toplevel groups and their toplevel children, and so on.

        my $txt = $group->as_txt();

Returns the group as Graph::Easy textual description.

        $group->_find_label_cell();

Called by the layouter once for each group. Goes through all cells of this group and finds one where to attach the label to. Internal usage only.

        my $att = $object->get_attributes();

Return all effective attributes on this object (graph/node/group/edge) as an anonymous hash ref. This respects inheritance and default values.

See also raw_attributes().

        my $att = $object->get_attributes();

Return all set attributes on this object (graph/node/group/edge) as an anonymous hash ref. This respects inheritance, but does not include default values for unset attributes.

See also get_attributes().

You can call all the various attribute related methods like "set_attribute()", "get_attribute()", etc. on a group, too. For example:

        $group->set_attribute('label', 'by train');
        my $attr = $group->get_attributes();

You can find more documentation in Graph::Easy.

This routine should not be called on groups, it only works on the graph itself.

        my $shape = $group->shape();

Returns the shape of the group as string.

        if ($group->has_as_successor($other))
          {
          ...
          }

Returns true if $other (a node or group) is a successor of this group, e.g. if there is an edge leading from this group to $other.

        if ($group->has_as_predecessor($other))
          {
          ...
          }

Returns true if the group has $other (a group or node) as predecessor, that is if there is an edge leading from $other to this group.

        my $root = $group->root_node();

Return the root node as Graph::Easy::Node object, if it was set with the 'root' attribute.

None by default.

Graph::Easy, Graph::Easy::Node, Graph::Easy::Manual.

Copyright (C) 2004 - 2008 by Tels <http://bloodgate.com>

See the LICENSE file for more details.

2016-06-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.