Changeset 3:272a5677bd6d in lemon0.x for src/include/oldgraph.h
 Timestamp:
 12/13/03 16:44:50 (19 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@15
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/include/oldgraph.h
r1 r3 112 112 int NodeNum() {return nodenum;}; 113 113 int EdgeNum(); 114 int MaxNode() {return nodes_size;};115 int FirstNode() {return firstnode;};116 int NextNode(int n) {return nodes[n].next;};117 int PrevNode(int n) {return nodes[n].prev;};118 N& operator()(int n) {return *(N*)(nodes[n].data);};119 N& Data (int n) {return *(N*)(nodes[n].data);};114 int MaxNode() const {return nodes_size;}; 115 int FirstNode() const {return firstnode;}; 116 int NextNode(int n) const {return nodes[n].next;}; 117 int PrevNode(int n) const {return nodes[n].prev;}; 118 N& operator()(int n) const {return *(N*)(nodes[n].data);}; 119 N& Data (int n) const {return *(N*)(nodes[n].data);}; 120 120 int AddNode(); 121 void AddNodeBlock(int n) {for(int i=0;i<n;i++) AddNode();}121 void AddNodeBlock(int n) const {for(int i=0;i<n;i++) AddNode();} 122 122 int AddNode(int n); 123 123 void Delete(int n); 124 int isaNode(int n) {return n>=0&&n<nodes_size&&nodes[n].indeg!=FREE_NODE;}; 125 126 int InDeg(int n) {return nodes[n].indeg;}; 127 int OutDeg(int n) {return nodes[n].outdeg;}; 128 EdgePoint FirstIn(int n) {return nodes[n].firstin;}; 129 EdgePoint FirstOut(int n) {return nodes[n].firstout;}; 130 131 E& operator()(EdgePoint e) {return *(E*)(((edge_t*)e)>data);}; 132 E& Data (EdgePoint e) {return *(E*)(((edge_t*)e)>data);}; 133 int From(EdgePoint e) {return e>from;}; 134 int To(EdgePoint e) {return e>to;}; 135 EdgePoint NextIn(EdgePoint e) 124 int isaNode(int n) const 125 {return n>=0&&n<nodes_size&&nodes[n].indeg!=FREE_NODE;}; 126 127 int InDeg(int n) const {return nodes[n].indeg;}; 128 int OutDeg(int n) const {return nodes[n].outdeg;}; 129 EdgePoint FirstIn(int n) const {return nodes[n].firstin;}; 130 EdgePoint FirstOut(int n) const {return nodes[n].firstout;}; 131 132 E& operator()(EdgePoint e) const {return *(E*)(((edge_t*)e)>data);}; 133 E& Data (EdgePoint e) const {return *(E*)(((edge_t*)e)>data);}; 134 int From(EdgePoint e) const {return e>from;}; 135 int To(EdgePoint e) const {return e>to;}; 136 EdgePoint NextIn(EdgePoint e) const 136 137 {return e>nextin;}; 137 EdgePoint NextOut(EdgePoint e) 138 EdgePoint NextOut(EdgePoint e)const 138 139 {return e>nextout;}; 139 140 EdgePoint AddEdge(int f, int t); … … 142 143 // EdgePoint Edge(E &d) 143 144 // {return (EdgePoint)(((char*)&d)(char*)&(((edge_t*)NULL)>data));}; 144 E& operator()(int f, int t) {return *(E*)(((edge_t*)Edge(f,t))>data);};145 E& Data(int f, int t) {return *(E*)(((edge_t*)Edge(f,t))>data);};145 E& operator()(int f, int t) const {return *(E*)(((edge_t*)Edge(f,t))>data);}; 146 E& Data(int f, int t) const {return *(E*)(((edge_t*)Edge(f,t))>data);}; 146 147 void Delete(int f, int t) {Delete(Edge(f,t));}; 147 148 void Reverse(EdgePoint e); … … 149 150 // Functions for EdgeIndex 150 151 151 EdgePoint Edge(EdgeIndex i) 152 EdgePoint Edge(EdgeIndex i) const 152 153 { return (EdgePoint)(edges[i.block]>fields+i.index);}; 153 EdgeIndex Index(EdgePoint e) { return e>index;};154 EdgeIndex Index(int f, int t) { EdgePoint e; return Edge(f,t)>index; }154 EdgeIndex Index(EdgePoint e) const { return e>index;}; 155 EdgeIndex Index(int f, int t) const { EdgePoint e; return Edge(f,t)>index; } 155 156 void Delete(EdgeIndex i) { Delete(Edge(i));}; 156 E& operator()(EdgeIndex i) 157 E& operator()(EdgeIndex i) const 157 158 {return *(E*)(edges[i.block]>fields[i.index].data);}; 158 E& Data(EdgeIndex i) 159 E& Data(EdgeIndex i) const 159 160 {return *(E*)(edges[i.block]>fields[i.index].data);}; 160 161 EdgePoint AddEdge(int f, int t,EdgeIndex in); … … 164 165 // Operators for symmetric graphs: 165 166 166 EdgePoint FirstEdge(int n) 167 EdgePoint FirstEdge(int n) const 167 168 { return (EdgePoint)(FirstIn(n)?FirstIn(n):FirstOut(n));}; 168 EdgePoint NextEdge(int n,EdgePoint e) 169 EdgePoint NextEdge(int n,EdgePoint e) const 169 170 { return From(e)==n?NextOut(e):(NextIn(e)?NextIn(e):FirstOut(n)); }; 170 int Opposite(EdgePoint e,int n) 171 int Opposite(EdgePoint e,int n) const 171 172 { return From(e)+To(e)n; }; 172 173 … … 223 224 template<class N, class E> void OldGraph<N,E>::destroy() 224 225 { 225 edge_block *oe;226 226 int i; 227 227
Note: See TracChangeset
for help on using the changeset viewer.