Graph

## class Graph

> (abstract) graph class.

## Inheritance:

### Public Methods

  | Graph ()
  virtual | ~Graph ()
  void | AddNode (Node *node)
  void | AddEdge (Edge *edge)
  void | RemoveNode (Node *node)
  void | RemoveEdge (Edge *edge)
  bool | HasNode (Node *node)
  bool | HasEdge (Edge *edge)
  void | ClearNodes ()
  void | ClearEdges ()
  bool | CheckConnection (int stype1, int stype2, int edgetype) checks if edge type may connect subject types 1 and 2.
  bool | IsConnected (Subject *s1, Subject *s2) checks if there is an edge in the graph that connects s1 and s2.
  bool | IsConnected (Subject *s1, Subject *s2, const string *n) same as above, but edge should also have name n.
  bool | IsConnected (Subject *s1, Subject *s2, int t) here edge should also be of type t.
  bool | IsConnected (Subject *s1, Subject *s2, const string *n, int t) combination of the two members above.
  int | CompleteSubjects (List<Subject *> *l) add to l all edges which connect the subjects.
  int | CompleteSubject (List<Subject *> *l, Subject *s) add to l all edges of which subject s is part.
  int | CompleteSubject (List<Subject *> *l, Subject *s1, Subject *s2) add to l all edges which connect subjects s1 and s2.
  int | CompleteEdges (List<Subject *> *l) add to l all subjects which are connected by edges already in l.
  int | GetConnected (List<Subject *> *l, Subject *s) add to l the subjects that are directly connected to subject s.
  int | GetNodes (List<Subject *> *l) add to l all nodes in the graph.
  int | GetNodes (List<Subject *> *l, int t) add to l all nodes of type t in the graph.
  int | GetNodes (List<Subject *> *l, const string *n) add to l all nodes having name n in the graph.
  int | GetNodes (List<Subject *> *l, const string *n, int t) combination of two above members.
  int | GetEdges (List<Subject *> *l) add to l all edges in the graph.
  int | GetEdges (List<Subject *> *l, int t) add to l all edges of type t in the graph.
  int | GetEdges (List<Subject *> *l, const string *n) add to l all edges having name n in the graph.
  int | GetEdges (List<Subject *> *l, const string *n, int t) combination of two above members.
  int | GetEdgesFrom (List<Subject *> *l, Subject *s) add to l all edges departing from subject s in the graph.
  int | GetEdgesFrom (List<Subject *> *l, Subject *s, int t) add to l all edges of type t departing from subject s.
  int | GetEdgesFrom (List<Subject *> *l, Subject *s, const string *n) add to l all edges having name n departing from subject s.
  int | GetEdgesFrom (List<Subject *> *l, Subject *s, const string *n, int t) combination of two above members.
  int | GetEdgesTo (List<Subject *> *l, Subject *s) add to l all edges going to subject s.
  int | GetEdgesTo (List<Subject *> *l, Subject *s, int t) add to l all edges of type t going to subject s.
  int | GetEdgesTo (List<Subject *> *l, Subject *s, const string *n) add to l all edges having name n going to subject s.
  int | GetEdgesTo (List<Subject *> *l, Subject *s, const string *n, int t) combination of the two above members.
  int | GetEdges (List<Subject *> *l, Subject *from, Subject *to) add to l all edges between subjects from and to
  int | GetEdges (List<Subject *> *l, Subject *from, Subject *to, int t) add to l all edges of type t between subjects from and to
  int | GetEdges (List<Subject *> *l, Subject *from, Subject *to, const string *n) combination of the two above members.
  int | GetEdges (List<Subject *> *l, Subject *from, Subject *to, const string *n, int t) combination of two above members.
  int | CountNodes () return number of nodes in the graph
  int | CountNodes (int t) return number of nodes of type t in the graph
  int | CountNodes (const string *n) return number of nodes having name n in the graph
  int | CountNodes (const string *n, int t) return nr. of nodes of type t, having name n in the graph
  int | CountEdges () return number of edges in the graph
  int | CountEdges (int t) return number of edges of type t in the graph
  int | CountEdges (const string *n) return number of edges having name n in the graph
  int | CountEdges (const string *n, int t) return nr. of edges of type t, having name n in the graph
  int | CountEdgesFrom (Subject *s) return nr. of edges departing from subject s
  int | CountEdgesFrom (Subject *s, int t) return nr. of edges of type t departing from subject s
  int | CountEdgesFrom (Subject *s, const string *n) return number of edges having name n departing from subject s
  int | CountEdgesFrom (Subject *s, const string *n, int t) return number of edges of type t, having name n, departing from subject s
  int | CountEdgesTo (Subject *s) return nr. of edges going to subject s
  int | CountEdgesTo (Subject *s, int t) return nr. of edges of type t going to subject s
  int | CountEdgesTo (Subject *s, const string *n) return number of edges having name n going to subject s
  int | CountEdgesTo (Subject *s, const string *n, int t) return number of edges of type t, having name n going to subject s
  int | CountEdges (Subject *s1, Subject *s2) return number of edges between subjects s1 and s2
  int | CountEdges (Subject *s1, Subject *s2, int t) return number of edges of type t between subjects s1 and s2
  int | CountEdges (Subject *s1, Subject *s2, const string *n) return number of edges having name n between subjects s1 and s2
  int | CountEdges (Subject *s1, Subject *s2, const string *n, int t) return number of edges of type t, having name n between subjects s1 and s2
  bool | PathExists (Subject *s1, Subject *s2) returns if there is some connected path of graph edges from s1 to s2.
  bool | PathExists (Subject *s1, Subject *s2, int t) returns if there is some conn. path of graph edges of type t from s1 to s2.
  bool | UndirectedPathExists (Subject *s1, Subject *s2) return if there's path from s1 to s2. irregardless edge direction.
  void | WriteSubjects (OutputFile *f) Writes all nodes and edges to outputfile f.
  virtual void | InitConnections () initializes the table containing all allowed connections.
  void | SetCounter (int n) some counter can be used
  int | GetCounter ()
  void | SetIndexPrefix (const char *s) some string can be used as index prefix.
  void | SetIndexPrefix (const string *s)
  const string* | GetIndexPrefix () const
  void | GetIndex (string *s) index string := prefix + counter.
  virtual void | GetNextIndex (string *index) assign to index a new unique index
  virtual int | CountIndexes (const string *index) return number of nodes in the graph having this index.

### Protected Classes

  enum | Max. number of different connected types and edge types.

### Protected Fields

  int* | nodeTypes Allowed 'connected' types in graph (depends on type of editor).
  int* | edgeTypes Allowed edges type in graph (depends on type of editor).
  int | connections [MAX_TYPES][MAX_TYPES][MAX_TYPES] matrix to store what types can be connected by what edge types.
  List <Node *> * | nodes the graph nodes.
  List <Edge *> * | edges the graph edges.

### Protected Methods

  bool | PathExists (Subject *s1, Subject *s2, int edgetype, bool Directed) used by other PathExists.
  int | CountIndex (const string *index, List<Subject *> *l) return number of nodes in l having this index

## Documentation

> (abstract) graph class.

`Graph()`

`virtual ~Graph()`

`void AddNode(Node *node)`

`void AddEdge(Edge *edge)`

`void RemoveNode(Node *node)`

`void RemoveEdge(Edge *edge)`

`bool HasNode(Node *node)`

`bool HasEdge(Edge *edge)`

`void ClearNodes()`

`void ClearEdges()`

`bool CheckConnection(int stype1, int stype2, int edgetype)`
  checks if edge type may connect subject types 1 and 2.

`bool IsConnected(Subject *s1, Subject *s2)`
  checks if there is an edge in the graph that connects s1 and s2.

`bool IsConnected(Subject *s1, Subject *s2, const string *n)`
  same as above, but edge should also have name n.

`bool IsConnected(Subject *s1, Subject *s2, int t)`
  here edge should also be of type t.

`bool IsConnected(Subject *s1, Subject *s2, const string *n, int t)`
  combination of the two members above.

`int CompleteSubjects(List<Subject *> *l)`
  add to l all edges which connect the subjects.

`int CompleteSubject(List<Subject *> *l, Subject *s)`
  add to l all edges of which subject s is part.

`int CompleteSubject(List<Subject *> *l, Subject *s1, Subject *s2)`
  add to l all edges which connect subjects s1 and s2.

`int CompleteEdges(List<Subject *> *l)`
  add to l all subjects which are connected by edges already in l.

`int GetConnected(List<Subject *> *l, Subject *s)`
  add to l the subjects that are directly connected to subject s.

`int GetNodes(List<Subject *> *l)`
  add to l all nodes in the graph.

`int GetNodes(List<Subject *> *l, int t)`
  add to l all nodes of type t in the graph.

`int GetNodes(List<Subject *> *l, const string *n)`
  add to l all nodes having name n in the graph.

`int GetNodes(List<Subject *> *l, const string *n, int t)`
  combination of two above members.

`int GetEdges(List<Subject *> *l)`
  add to l all edges in the graph.

`int GetEdges(List<Subject *> *l, int t)`
  add to l all edges of type t in the graph.

`int GetEdges(List<Subject *> *l, const string *n)`
  add to l all edges having name n in the graph.

`int GetEdges(List<Subject *> *l, const string *n, int t)`
  combination of two above members.

`int GetEdgesFrom(List<Subject *> *l, Subject *s)`
  add to l all edges departing from subject s in the graph.

`int GetEdgesFrom(List<Subject *> *l, Subject *s, int t)`
  add to l all edges of type t departing from subject s.

`int GetEdgesFrom(List<Subject *> *l, Subject *s, const string *n)`
  add to l all edges having name n departing from subject s.

`int GetEdgesFrom(List<Subject *> *l, Subject *s, const string *n, int t)`
  combination of two above members.

`int GetEdgesTo(List<Subject *> *l, Subject *s)`
  add to l all edges going to subject s.

`int GetEdgesTo(List<Subject *> *l, Subject *s, int t)`
  add to l all edges of type t going to subject s.

`int GetEdgesTo(List<Subject *> *l, Subject *s, const string *n)`
  add to l all edges having name n going to subject s.

`int GetEdgesTo(List<Subject *> *l, Subject *s, const string *n, int t)`
  combination of the two above members.

`int GetEdges(List<Subject *> *l, Subject *from, Subject *to)`
  add to l all edges between subjects from and to

`int GetEdges(List<Subject *> *l, Subject *from, Subject *to, int t)`
  add to l all edges of type t between subjects from and to

`int GetEdges(List<Subject *> *l, Subject *from, Subject *to, const string *n)`
  combination of the two above members.

`int GetEdges(List<Subject *> *l, Subject *from, Subject *to, const string *n, int t)`
  combination of two above members.

`int CountNodes()`
  return number of nodes in the graph

`int CountNodes(int t)`
  return number of nodes of type t in the graph

`int CountNodes(const string *n)`
  return number of nodes having name n in the graph

`int CountNodes(const string *n, int t)`
  return nr. of nodes of type t, having name n in the graph

`int CountEdges()`
  return number of edges in the graph

`int CountEdges(int t)`
  return number of edges of type t in the graph

`int CountEdges(const string *n)`
  return number of edges having name n in the graph

`int CountEdges(const string *n, int t)`
  return nr. of edges of type t, having name n in the graph

`int CountEdgesFrom(Subject *s)`
  return nr. of edges departing from subject s

`int CountEdgesFrom(Subject *s, int t)`
  return nr. of edges of type t departing from subject s

`int CountEdgesFrom(Subject *s, const string *n)`
  return number of edges having name n departing from subject s

`int CountEdgesFrom(Subject *s, const string *n, int t)`
  return number of edges of type t, having name n, departing from subject s

`int CountEdgesTo(Subject *s)`
  return nr. of edges going to subject s

`int CountEdgesTo(Subject *s, int t)`
  return nr. of edges of type t going to subject s

`int CountEdgesTo(Subject *s, const string *n)`
  return number of edges having name n going to subject s

`int CountEdgesTo(Subject *s, const string *n, int t)`
  return number of edges of type t, having name n going to subject s

`int CountEdges(Subject *s1, Subject *s2)`
  return number of edges between subjects s1 and s2

`int CountEdges(Subject *s1, Subject *s2, int t)`
  return number of edges of type t between subjects s1 and s2

`int CountEdges(Subject *s1, Subject *s2, const string *n)`
  return number of edges having name n between subjects s1 and s2

`int CountEdges(Subject *s1, Subject *s2, const string *n, int t)`
  return number of edges of type t, having name n between subjects s1 and s2

`bool PathExists(Subject *s1, Subject *s2)`
  returns if there is some connected path of graph edges from s1 to s2.

`bool PathExists(Subject *s1, Subject *s2, int t)`
  returns if there is some conn. path of graph edges of type t from s1 to s2.

`bool UndirectedPathExists(Subject *s1, Subject *s2)`
  return if there's path from s1 to s2. irregardless edge direction.

`void WriteSubjects(OutputFile *f)`
  Writes all nodes and edges to outputfile f.

`virtual void InitConnections()`
  initializes the table containing all allowed connections.

`void SetCounter(int n)`
  some counter can be used

`int GetCounter()`

`void SetIndexPrefix(const char *s)`
  some string can be used as index prefix.

`void SetIndexPrefix(const string *s)`

`const string* GetIndexPrefix() const`

`void GetIndex(string *s)`
  index string := prefix + counter.

`virtual void GetNextIndex(string *index)`
  assign to index a new unique index

`virtual int CountIndexes(const string *index)`
  return number of nodes in the graph having this index.

`int* nodeTypes`
  Allowed 'connected' types in graph (depends on type of editor).

`int* edgeTypes`
  Allowed edges type in graph (depends on type of editor).

`enum`
  Max. number of different connected types and edge types.

`int connections[MAX_TYPES][MAX_TYPES][MAX_TYPES]`
  matrix to store what types can be connected by what edge types.

`List <Node *> * nodes`
  the graph nodes.

`List <Edge *> * edges`
  the graph edges.

`bool PathExists(Subject *s1, Subject *s2, int edgetype, bool Directed)`
  used by other PathExists.

`int CountIndex(const string *index, List<Subject *> *l)`
  return number of nodes in l having this index

Direct child classes:
  TRGraph
  STGraph
  SNGraph
  RPGraph
  PSGraph
  GDGraph
  ERGraph
  DFGraph
  CPGraph
  ATGraph

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de