Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 26da26f
  • /
  • Edge.h
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:0f166863c3db334834e7afef7555c7ae100d057b
directory badge
swh:1:dir:26da26f21e20c537231a6a2a775ea0e14c30ac05

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Edge.h
#ifndef EDGE_H
#define EDGE_H
#include "Vertex3D.h"
#include <algorithm>

using namespace std;

    // Class for represeting edges explicitly
    class Edge{
    private:
         int vertexes[2]; // Indices of the endpoints
    public:

        // Constructor
        inline Edge(){}
        inline Edge(int vi1, int vi2){
            vertexes[0]=min(vi1,vi2);
            vertexes[1]=max(vi1,vi2);
        }

        // Smaller-index endpoint getter
        inline int minindex() const{return vertexes[0];}

        // Bigger-index endpoint getter
        inline int maxindex() const{return vertexes[1];}

        inline int EV(int vPos) const
        {
            return vertexes[vPos];
        }

        //index of vertex v inside the edge
        inline short vertexindex(int v){
            if(vertexes[0]==v) return 0;
            if(vertexes[1]==v) return 1;
            return -1;
        }

        // Operators --------
        inline bool operator==(Edge edge){
            if(minindex()!=edge.minindex()) return false;
            if(maxindex()!=edge.maxindex()) return false;
            return true;
        }

        inline bool operator!=(Edge edge){
            return !((*this)==(edge));
        }

        inline bool operator<(Edge edge) const{
            if(maxindex() < edge.maxindex()) return true;
            else if(maxindex() == edge.maxindex() && minindex() < edge.minindex()) return true;
            else return false;
        }

        inline bool operator>(Edge edge) const{
            if(maxindex() > edge.maxindex()) return true;
            else if(maxindex() == edge.maxindex() && minindex() > edge.minindex()) return true;
            else return false;
        }


    };

#endif // EDGE_H

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API