-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgraph.cpp
More file actions
47 lines (37 loc) · 1.11 KB
/
graph.cpp
File metadata and controls
47 lines (37 loc) · 1.11 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
#include "graph/graph.h"
#include "util/param_mgr.h"
namespace fzur {
extern ParamMgr g_param_mgr; // global varaible
void Graph::Init(size_t num_nodes, size_t num_edges, size_t num_nets,
size_t num_net_groups) {
num_nodes_ = num_nodes;
num_edges_ = num_edges;
num_nets_ = num_nets;
num_groups_ = num_net_groups;
for (id_t i = 0; i < num_nets; ++i) {
nets_.push_back(Net());
nets_[i].SetId(i);
}
netgroups_.resize(num_net_groups);
edge_nets_.resize(num_edges);
routing_count_.assign(num_edges, 0); // initialized to 0
node_nets.resize(num_nodes);
}
void Graph::ShowRoutingFrequencyOfAllEdges() const {
std::cout << "Routing frequency of all edges:\n";
std::cout << "edge id| #nets| net ids\n";
for (size_t i = 0; i < NumEdges(); ++i) {
std::cout << " " << i << "\t" << routing_count_[i] << '\t';
for (auto& net_id : edge_nets_[i]) {
std::cout << net_id << ' ';
}
std::cout << '\n';
}
std::cout << "\n";
}
void Graph::OutputResult(std::ostream& out) const {
for (const auto& net : nets_) {
net.ShowEdgeRatios(out);
}
}
} // namespace fzur