.
authormarci
Tue, 23 Mar 2004 13:47:31 +0000
changeset 2393f76d1aa9d37
parent 238 ad3bdd78f4f6
child 240 4a1d2e642552
.
src/work/marci/graph_wrapper.h
     1.1 --- a/src/work/marci/graph_wrapper.h	Tue Mar 23 13:31:02 2004 +0000
     1.2 +++ b/src/work/marci/graph_wrapper.h	Tue Mar 23 13:47:31 2004 +0000
     1.3 @@ -540,17 +540,24 @@
     1.4        operator GraphEdge() const {
     1.5  	if (out_or_in) return(out); else return(in);
     1.6        }
     1.7 +//FIXME
     1.8 +//2 edges are equal if they "refer" to the same physical edge 
     1.9 +//is it good?
    1.10        friend bool operator==(const Edge& u, const Edge& v) { 
    1.11  	if (v.out_or_in) 
    1.12 -	  return (u.out_or_in && u.out==v.out);
    1.13 +	  if (u.out_or_in) return (u.out==v.out); else return (u.out==v.in);
    1.14 +	//return (u.out_or_in && u.out==v.out);
    1.15  	else
    1.16 -	  return (!u.out_or_in && u.in==v.in);
    1.17 +	  if (u.out_or_in) return (u.out==v.in); else return (u.in==v.in);
    1.18 +	//return (!u.out_or_in && u.in==v.in);
    1.19        } 
    1.20        friend bool operator!=(const Edge& u, const Edge& v) { 
    1.21  	if (v.out_or_in) 
    1.22 -	  return (!u.out_or_in || u.out!=v.out);
    1.23 +	  if (u.out_or_in) return (u.out!=v.out); else return (u.out!=v.in);
    1.24 +	//return (!u.out_or_in || u.out!=v.out);
    1.25  	else
    1.26 -	  return (u.out_or_in || u.in!=v.in);
    1.27 +	  if (u.out_or_in) return (u.out!=v.in); else return (u.in!=v.in);
    1.28 +	//return (u.out_or_in || u.in!=v.in);
    1.29        } 
    1.30      };
    1.31  
    1.32 @@ -561,12 +568,8 @@
    1.33        OutEdgeIt(const Invalid& i) : Edge(i) { }
    1.34        OutEdgeIt(const UndirGraphWrapper<GraphWrapper>& _G, const Node& n) 
    1.35  	: Edge() { 
    1.36 -	out_or_in=true;
    1.37 -	_G.gw.first(out, n);
    1.38 -	if (!(_G.gw.valid(out))) {
    1.39 -	  out_or_in=false;
    1.40 -	  _G.gw.first(in, n);
    1.41 -	}
    1.42 +	out_or_in=true; _G.gw.first(out, n);
    1.43 +	if (!(_G.gw.valid(out))) { out_or_in=false; _G.gw.first(in, n);	}
    1.44        }
    1.45      };
    1.46  
    1.47 @@ -593,12 +596,8 @@
    1.48      };
    1.49  
    1.50      OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
    1.51 -      e.out_or_in=true;
    1.52 -      gw.first(e.out, n);
    1.53 -      if (!(gw.valid(e.out))) {
    1.54 -	e.out_or_in=false;
    1.55 -	gw.first(e.in, n);
    1.56 -      }
    1.57 +      e.out_or_in=true; gw.first(e.out, n);
    1.58 +      if (!(gw.valid(e.out))) { e.out_or_in=false; gw.first(e.in, n); }
    1.59        return e;
    1.60      }
    1.61  
    1.62 @@ -622,10 +621,7 @@
    1.63        if (e.out_or_in) {
    1.64  	Node n=gw.tail(e.out);
    1.65  	gw.next(e.out);
    1.66 -	if (!gw.valid(e.out)) {
    1.67 -	  e.out_or_in=false;
    1.68 -	  gw.first(e.in, n);
    1.69 -	}
    1.70 +	if (!gw.valid(e.out)) { e.out_or_in=false; gw.first(e.in, n); }
    1.71        } else {
    1.72  	gw.next(e.in);
    1.73        }
    1.74 @@ -643,9 +639,7 @@
    1.75      }
    1.76  
    1.77      template<typename I> I& next(I &i) const { return gw.next(i); }    
    1.78 -    
    1.79 -    template<typename I> I getNext(const I& i) const { 
    1.80 -      return gw.getNext(i); }
    1.81 +    template<typename I> I getNext(const I& i) const { return gw.getNext(i); }
    1.82  
    1.83      template< typename It > It first() const { 
    1.84        It e; first(e); return e; }