libgexf  0.1.3
directedgraph.h
Go to the documentation of this file.
1 
7 /*
8 # Copyright (c) <2009> <Sebastien Heymann>
9 #
10 # Permission is hereby granted, free of charge, to any person obtaining a copy
11 # of this software and associated documentation files (the "Software"), to deal
12 # in the Software without restriction, including without limitation the rights
13 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 # copies of the Software, and to permit persons to whom the Software is
15 # furnished to do so, subject to the following conditions:
16 #
17 # The above copyright notice and this permission notice shall be included in
18 # all copies or substantial portions of the Software.
19 #
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 # THE SOFTWARE.
27 */
28 
29 #ifndef _DIRECTEDGRAPH_H
30 #define _DIRECTEDGRAPH_H
31 
32 #include "graph.h"
33 #include <vector>
34 
35 namespace libgexf {
36 
40 class DirectedGraph: public Graph {
41 public:
42  DirectedGraph();
43 
47  DirectedGraph(const DirectedGraph& orig);
48 
49  virtual ~DirectedGraph();
50 
56  void removeInEdges(const libgexf::t_id target_id);
57 
63  void removeOutEdges(const libgexf::t_id source_id);
64 
71  std::vector<libgexf::t_id> getInEdges(const libgexf::t_id node_id) const;
72 
79  std::vector<libgexf::t_id> getOutEdges(const libgexf::t_id node_id) const;
80 
87  std::vector<libgexf::t_id> getSuccessors(const libgexf::t_id node_id) const;
88 
95  std::vector<libgexf::t_id> getPredecessors(const libgexf::t_id node_id) const;
96 
97 
104  unsigned int getInDegree(const libgexf::t_id node_id) const;
105 
112  unsigned int getOutDegree(const libgexf::t_id node_id) const;
113 
114 
124  bool isSuccessor(const libgexf::t_id node_id, const libgexf::t_id successor_id) const;
125 
135  bool isPredecessor(const libgexf::t_id node_id, const libgexf::t_id predecessor_id) const;
136 private:
137  DirectedGraph& operator=(const DirectedGraph& orig);
138 };
139 
140 }
141 
142 #endif /* _DIRECTEDGRAPH_H */
143 
std::string t_id
Definition: typedefs.h:35
Definition: abstractiter.h:32
std::vector< libgexf::t_id > getSuccessors(const libgexf::t_id node_id) const
Get node successors.
Definition: directedgraph.cpp:128
bool isPredecessor(const libgexf::t_id node_id, const libgexf::t_id predecessor_id) const
Test a possible predecessor.
Definition: directedgraph.cpp:240
std::vector< libgexf::t_id > getPredecessors(const libgexf::t_id node_id) const
Get node predecessors.
Definition: directedgraph.cpp:148
void removeInEdges(const libgexf::t_id target_id)
Remove incoming edges from a node.
Definition: directedgraph.cpp:47
unsigned int getOutDegree(const libgexf::t_id node_id) const
Get outdegree value.
Definition: directedgraph.cpp:198
std::vector< libgexf::t_id > getInEdges(const libgexf::t_id node_id) const
Get incoming edges from a node.
Definition: directedgraph.cpp:83
Topology structure of the graph.
Definition: graph.h:49
std::vector< libgexf::t_id > getOutEdges(const libgexf::t_id node_id) const
Get outgoing edges from a node.
Definition: directedgraph.cpp:108
unsigned int getInDegree(const libgexf::t_id node_id) const
Get indegree value.
Definition: directedgraph.cpp:168
void removeOutEdges(const libgexf::t_id source_id)
Remove outgoing edges from a node.
Definition: directedgraph.cpp:66
Interpretation of the topology structure as a directed graph.
Definition: directedgraph.h:40
bool isSuccessor(const libgexf::t_id node_id, const libgexf::t_id successor_id) const
Test a possible successor.
Definition: directedgraph.cpp:226