The Standard Graph module is an original implementation dedicated to the graph modeling and manipulation. At the heart of this module is the concept of edges and vertices. The module also provides support for automaton.
The afnix-gfx module provides the support for manipulating
graphs. Formally a graph is a collection of edges and vertices. In
a normal graph, an edge connects two vertices. On the other hand,
a vertex can have several edges. When an edge connects several
vertices, it is called an hyperedge and the resulting structure is
called an hypergraph.
The Edge class is a class used for a graph
construction in association with the Vertex class.
An edge is used to connect vertices. Normally, an edge connects
two vertices. The number of vertices attached to an edge is
called the cardinality of that edge. When the edge cardinality
is one, the edge is called a self-loop. This mean that the edge
connects the vertex to itself. This last point is merely a
definition but present the advantage of defining an hyperedge as
a set of vertices.
The Vertex is the other class used for the
graph construction. and operates with the edge
class. A vertex is used to reference edges. the number of edges
referenced by a vertex is called the degree of that vertex.
The Graph class is class that represent either a
graph or a hypergraph. By definition, a graph is collection of
edges and vertices. There are numerous property attached to
graph. Formally, a graph consists of a set of edges, a set of
vertices and the associated endpoints. However, the implementation
is designed in a way so that each edge and vertex carry its
associated objects. This method ensures that the graph is fully
defined by only its two sets.
The graph construction is quite simple and proceed by adding edges and vertices. The base system does not enforce rules on the graph structure. it is possible to add con connected vertices as well as unreferenced edges.
An edge is constructed by simply invoking the default constructor. Optionally, a client object can be attached to the edge.
The edge-p predicate can be used to check for the
object type. When an edge is created with client object, the
get-client method can be used to access that object.
A vertex is constructed a way similar to the Edge>
object. The vertex is constructed by simply invoking the default
constructor. Optionally, a client object can be attached to the
edge.
The vertex-p predicate can be used to check for the
object type. When a vertex is created with a client object, the
get-client method can be used to access that object.
A graph is constructed by simply adding edges and vertices to
it. The graph-p predicate can be use to assert the
graph type. the graph class also supports the concept of client
object which can be attached at construction or with the
set-client method.
The add method can be used to add edges or vertices
to the graph. The important point is that during the
construction process, the graph structure is updated with the
proper number of edge and vertices.