41 #ifndef DIRECTEDVERTEX_H_
42 #define DIRECTEDVERTEX_H_
55 template<
typename V,
typename E>
63 AdjListMap* incoming, *outgoing;
88 virtual void adjacent(std::vector<V*>& out);
91 virtual void edges(
EdgeType type , std::vector<boost::shared_ptr<E> >& out);
100 template<
typename V,
typename E>
102 incoming =
new AdjListMap();
103 outgoing =
new AdjListMap();
106 template<
typename V,
typename E>
112 template<
typename V,
typename E>
117 template<
typename V,
typename E>
119 boost::shared_ptr<E> ret;
121 AdjListMapIterator iter = adjMap->find(other);
122 return (iter != adjMap->end() ? iter->second : ret);
125 template<
typename V,
typename E>
128 else (*outgoing)[other] = edge;
131 template<
typename V,
typename E>
133 this->getItems(outgoing, out);
136 template<
typename V,
typename E>
138 this->getItems(incoming, out);
141 template<
typename V,
typename E>
143 this->getItems(incoming, out);
144 this->getItems(outgoing, out);
147 template<
typename V,
typename E>
149 return incoming->size();
152 template<
typename V,
typename E>
154 return outgoing->size();
157 template<
typename V,
typename E>
virtual boost::shared_ptr< E > removeEdge(Vertex *other, EdgeType type)=0
Removes the edge of the specified type between this Vertex and the specified Vertex.
virtual void edges(EdgeType type, std::vector< boost::shared_ptr< E > > &out)=0
Gets all the edges of the specified type in which this Vertex participates and return them in out.
int inDegree()
Gets the in degree of this Vertex.
Definition: DirectedVertex.h:148
virtual void adjacent(std::vector< V * > &out)
Gets the Vertices adjacent to this Vertex.
Definition: DirectedVertex.h:142
virtual void predecessors(std::vector< V * > &out)
Gets the predecessors of this Vertex.
Definition: DirectedVertex.h:137
virtual void edges(EdgeType type, std::vector< boost::shared_ptr< E > > &out)
Gets all the edges of the specified type in which this Vertex participates and return them in out.
Definition: DirectedVertex.h:158
Used internally by repast graphs / networks to encapsulate Vertices.
Definition: Vertex.h:52
int outDegree()
Gets the out degree of this Vertex.
Definition: DirectedVertex.h:153
Used internally by repast graphs / networks to encapsulate the vertices of a directed graph.
Definition: DirectedVertex.h:56
boost::unordered_map< Vertex< V, E > *, boost::shared_ptr< E >, HashVertex< V, E > > AdjListMap
Typedef for the adjacency list map that contains the other Vertices that this Vertex links to.
Definition: Vertex.h:92
boost::shared_ptr< V > item() const
Gets the item that this Vertex contains.
Definition: Vertex.h:192
EdgeType
Enum the identifies whether an edge is incoming or outgoing.
Definition: Vertex.h:98
virtual void addEdge(Vertex< V, E > *other, boost::shared_ptr< E > edge, EdgeType type)
Adds an edge of the specified type between this Vertex and the specified vertex.
Definition: DirectedVertex.h:126
virtual boost::shared_ptr< E > removeEdge(Vertex< V, E > *other, EdgeType type)
Removes the edge of the specified type between this Vertex and the specified Vertex.
Definition: DirectedVertex.h:113
virtual void successors(std::vector< V * > &out)
Gets the successors of this Vertex.
Definition: DirectedVertex.h:132
virtual boost::shared_ptr< E > findEdge(Vertex< V, E > *other, EdgeType type)
Finds the edge of the specified type between this Vertex and the specified vertex.
Definition: DirectedVertex.h:118
DirectedVertex(boost::shared_ptr< V > item)
Creates a DirectedVertex that will contain the specified item.
Definition: DirectedVertex.h:101