-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLightGraph.H
More file actions
65 lines (61 loc) · 2.12 KB
/
LightGraph.H
File metadata and controls
65 lines (61 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/****************************************************************
LightGraph.H
Copyright (C)2013 William H. Majoros (martiandna@gmail.com).
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
****************************************************************/
#ifndef INCL_LightGraph_H
#define INCL_LightGraph_H
#include <iostream>
#include "BOOM/Vector.H"
#include "BOOM/Regex.H"
#include "LightEdge.H"
#include "LightVertex.H"
using namespace std;
using namespace BOOM;
class LightGraph {
public:
LightGraph(const String &filename);
LightGraph(File &);
LightGraph(const String &substrate,int substrateLength);
virtual ~LightGraph();
void addVertex(LightVertex*);
void addEdge(LightEdge*);
void sort();
void sortVertices();
void sortEdges();
bool save(const String &filename);
bool save(ostream &);
int getNumVertices() const;
int getNumEdges() const;
int getLargestEdgeID() const;
LightVertex *getVertex(int);
LightEdge *getEdge(int);
const String &getSubstrate() const;
void printOn(ostream &);
inline int getSubstrateLength() { return substrateLength; }
void getATGs(Vector<LightVertex*> &);
void getAnnotatedATGs(Vector<LightVertex*> &);
void dropVertex(int index); // doesn't delete it, sets pointer to NULL
void dropEdge(int index); // doesn't delete it, sets pointer to NULL
void deleteNullVertices();
void deleteNullEdges();
void deleteDuplicates();
void deleteVertex(int index); // dangerous! invalidates indices!
void deleteEdge(int index); // dangerous! invalidates indices!
LightVertex *vertexExists(const String &substrate,Strand,int begin,int end,
SignalType) const;
LightEdge *edgeExists(const String &substrate,Strand,int begin,int end,
ContentType) const;
protected:
Regex leftRegex, rightRegex, edgeIdRegex, annoRegex, IdRegex;
Vector<LightVertex*> vertices;
Vector<LightEdge*> edges;
String substrate;
int substrateLength;
bool load(File &);
void deleteIncidentEdges(LightVertex *);
void deleteEdges(Vector<LightEdge*> &);
};
ostream &operator<<(ostream &,const LightGraph &);
#endif