Last change
on this file since 9 was
9,
checked in by gnappo, 14 years ago
|
Migrato il resto del codice verso Jung.
|
File size:
1.6 KB
|
Line | |
---|
1 | package weka.clusterers.forMetisMQI; |
---|
2 | |
---|
3 | |
---|
4 | public class Node { |
---|
5 | |
---|
6 | private String id; |
---|
7 | |
---|
8 | /** The weight of the node */ |
---|
9 | private int vwgt; |
---|
10 | /** The size of the adjacency list of the node */ |
---|
11 | private int nedges; |
---|
12 | /** |
---|
13 | * The index into the adjacency list that is the beginning of the adjacency |
---|
14 | * list of v |
---|
15 | */ |
---|
16 | private int iedges; |
---|
17 | /** The weight of the edges that have been contracted to create the node */ |
---|
18 | private int cewgt; |
---|
19 | /** The sum of the weight of the edges adjacent to v */ |
---|
20 | private int adjwgt; |
---|
21 | |
---|
22 | public Node(String id) { |
---|
23 | this.id = id; |
---|
24 | this.vwgt = 1; |
---|
25 | this.cewgt = 0; |
---|
26 | this.iedges = 0; |
---|
27 | this.nedges = 0; |
---|
28 | this.adjwgt = 0; |
---|
29 | } |
---|
30 | |
---|
31 | @Override |
---|
32 | public boolean equals(Object o) { |
---|
33 | return (o instanceof Node) && (((Node) o).getId().equals(id)); |
---|
34 | } |
---|
35 | |
---|
36 | @Override |
---|
37 | public int hashCode() { |
---|
38 | int hash = 1; |
---|
39 | hash = hash * 31 + id.hashCode(); |
---|
40 | return hash; |
---|
41 | } |
---|
42 | |
---|
43 | public String getId() { |
---|
44 | return id; |
---|
45 | } |
---|
46 | |
---|
47 | @Override |
---|
48 | public String toString() { |
---|
49 | return "N" + id; |
---|
50 | } |
---|
51 | |
---|
52 | public int getVwgt() { |
---|
53 | return vwgt; |
---|
54 | } |
---|
55 | |
---|
56 | public void setVwgt(int vwgt) { |
---|
57 | this.vwgt = vwgt; |
---|
58 | } |
---|
59 | |
---|
60 | public int getNedges() { |
---|
61 | return nedges; |
---|
62 | } |
---|
63 | |
---|
64 | public void setNedges(int nedges) { |
---|
65 | this.nedges = nedges; |
---|
66 | } |
---|
67 | |
---|
68 | public int getIedges() { |
---|
69 | return iedges; |
---|
70 | } |
---|
71 | |
---|
72 | public void setIedges(int iedges) { |
---|
73 | this.iedges = iedges; |
---|
74 | } |
---|
75 | |
---|
76 | public int getCewgt() { |
---|
77 | return cewgt; |
---|
78 | } |
---|
79 | |
---|
80 | public void setCewgt(int cewgt) { |
---|
81 | this.cewgt = cewgt; |
---|
82 | } |
---|
83 | |
---|
84 | public int getAdjwgt() { |
---|
85 | return adjwgt; |
---|
86 | } |
---|
87 | |
---|
88 | public void setAdjwgt(int adjwgt) { |
---|
89 | this.adjwgt = adjwgt; |
---|
90 | } |
---|
91 | |
---|
92 | @Override |
---|
93 | public Node clone() { |
---|
94 | Node n = new Node(id); |
---|
95 | n.adjwgt = adjwgt; |
---|
96 | n.cewgt = cewgt; |
---|
97 | n.iedges = iedges; |
---|
98 | n.nedges = nedges; |
---|
99 | n.vwgt = vwgt; |
---|
100 | return n; |
---|
101 | } |
---|
102 | |
---|
103 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.