Skip to content

Commit c8d58d1

Browse files
committed
format
1 parent 05acd7c commit c8d58d1

File tree

4 files changed

+324
-324
lines changed

4 files changed

+324
-324
lines changed

CS2420_CS3/7-GraphCycles/edge.hpp

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,61 @@
55
#include <sstream>
66

77
class Edge
8-
{
9-
public:
10-
int fromNode; // Subscript of other endpoint in node array
11-
int toNode; // Subscript of one endpoint in node array. Nodes are stored as numbers, but printed as characters.
12-
int cycleID; // Cycle which the edge is a member of, -1 if it is included in no cycle
13-
int order;
14-
bool used; // true if edge is used in final tour
8+
{
9+
public:
10+
int fromNode; // Subscript of other endpoint in node array
11+
int toNode; // Subscript of one endpoint in node array. Nodes are stored as numbers, but printed as characters.
12+
int cycleID; // Cycle which the edge is a member of, -1 if it is included in no cycle
13+
int order;
14+
bool used; // true if edge is used in final tour
1515

16-
Edge(char f, char t): cycleID(-1), order(-1), used(false) { set(f, t); }//constructor with vertex letters
17-
Edge(int f, int t): cycleID(-1), order(-1), used(false) { set(f, t); }//constructor with vertex numbers
16+
Edge(char f, char t): cycleID(-1), order(-1), used(false) { set(f, t); }//constructor with vertex letters
17+
Edge(int f, int t): cycleID(-1), order(-1), used(false) { set(f, t); }//constructor with vertex numbers
1818

19-
// Create a string version of Edge
20-
// Edge endpoints are stored as numbers, but printed as characters.
21-
std::string toString() const
22-
{
23-
std::ostringstream os; // allows string to act like stream to use stream operations
24-
char f = fromNode + 'A';
25-
char t = toNode + 'A';
26-
os << f << "-" << t << " (" << cycleID << ") (" << order << ") ";
27-
return os.str();
28-
}
19+
// Create a string version of Edge
20+
// Edge endpoints are stored as numbers, but printed as characters.
21+
std::string toString() const
22+
{
23+
std::ostringstream os; // allows string to act like stream to use stream operations
24+
char f = fromNode + 'A';
25+
char t = toNode + 'A';
26+
os << f << "-" << t << " (" << cycleID << ") (" << order << ") ";
27+
return os.str();
28+
}
2929

30-
// if one Node is an endpoint, return other endpoint
31-
int getOther(int oneNode) const
32-
{
33-
if (fromNode == oneNode) return toNode;
34-
assert(toNode == oneNode);
35-
return fromNode;
36-
}
30+
// if one Node is an endpoint, return other endpoint
31+
int getOther(int oneNode) const
32+
{
33+
if (fromNode == oneNode) return toNode;
34+
assert(toNode == oneNode);
35+
return fromNode;
36+
}
3737

38-
// Set initial values of an edge from Node f to Node t (char)
39-
void set(char f, char t)
40-
{
41-
fromNode = f - 'A';
42-
toNode = t - 'A';
43-
cycleID = -1;
44-
used = false;
45-
//std::cout << "creating Edge " << toString() << std::endl;
46-
}
38+
// Set initial values of an edge from Node f to Node t (char)
39+
void set(char f, char t)
40+
{
41+
fromNode = f - 'A';
42+
toNode = t - 'A';
43+
cycleID = -1;
44+
used = false;
45+
//std::cout << "creating Edge " << toString() << std::endl;
46+
}
4747

48-
// Set initial values of an edge from Node f to Node t (int)
49-
void set(int f, int t)
50-
{
51-
fromNode = f;
52-
toNode = t;
53-
cycleID = -1;
48+
// Set initial values of an edge from Node f to Node t (int)
49+
void set(int f, int t)
50+
{
51+
fromNode = f;
52+
toNode = t;
53+
cycleID = -1;
5454

55-
used = false;
56-
//std::cout << "creating Edge " << toString() << std::endl;
57-
}
55+
used = false;
56+
//std::cout << "creating Edge " << toString() << std::endl;
57+
}
5858

59-
friend bool operator== (Edge const & a, Edge const & b)
60-
{
61-
return (a.fromNode == b.fromNode && a.toNode == b.toNode);
62-
}
59+
friend bool operator== (Edge const & a, Edge const & b)
60+
{
61+
return (a.fromNode == b.fromNode && a.toNode == b.toNode);
62+
}
6363
};
6464

6565
#endif

0 commit comments

Comments
 (0)