gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Converting INVALID arc to INVALID edge
0 2 0
default
2 files changed with 6 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -833,25 +833,27 @@
833 833
      bool operator!=(const Edge& edge) const {return id != edge.id;}
834 834
      bool operator<(const Edge& edge) const {return id < edge.id;}
835 835
    };
836 836

	
837 837
    class Arc {
838 838
      friend class ListGraphBase;
839 839
    protected:
840 840

	
841 841
      int id;
842 842
      explicit Arc(int pid) { id = pid;}
843 843

	
844 844
    public:
845
      operator Edge() const { return edgeFromId(id / 2); }
845
      operator Edge() const { 
846
        return id != -1 ? edgeFromId(id / 2) : INVALID; 
847
      }
846 848

	
847 849
      Arc() {}
848 850
      Arc (Invalid) { id = -1; }
849 851
      bool operator==(const Arc& arc) const {return id == arc.id;}
850 852
      bool operator!=(const Arc& arc) const {return id != arc.id;}
851 853
      bool operator<(const Arc& arc) const {return id < arc.id;}
852 854
    };
853 855

	
854 856

	
855 857

	
856 858
    ListGraphBase()
857 859
      : nodes(), first_node(-1),
Ignore white space 24 line context
... ...
@@ -456,25 +456,27 @@
456 456
      bool operator!=(const Edge& arc) const {return _id != arc._id;}
457 457
      bool operator<(const Edge& arc) const {return _id < arc._id;}
458 458
    };
459 459

	
460 460
    class Arc {
461 461
      friend class SmartGraphBase;
462 462
    protected:
463 463

	
464 464
      int _id;
465 465
      explicit Arc(int id) { _id = id;}
466 466

	
467 467
    public:
468
      operator Edge() const { return edgeFromId(_id / 2); }
468
      operator Edge() const { 
469
        return _id != -1 ? edgeFromId(_id / 2) : INVALID; 
470
      }
469 471

	
470 472
      Arc() {}
471 473
      Arc (Invalid) { _id = -1; }
472 474
      bool operator==(const Arc& arc) const {return _id == arc._id;}
473 475
      bool operator!=(const Arc& arc) const {return _id != arc._id;}
474 476
      bool operator<(const Arc& arc) const {return _id < arc._id;}
475 477
    };
476 478

	
477 479

	
478 480

	
479 481
    SmartGraphBase()
480 482
      : nodes(), arcs() {}
0 comments (0 inline)