Skip to content
Snippets Groups Projects
Commit ce7b13b3 authored by beginner1010's avatar beginner1010
Browse files

Per Vertex is udpated

parent d4cad6a1
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
......@@ -85,55 +85,47 @@ public class perVertexParMCE_Total {
public void expand(TreeSet<Integer> K, Collection<Integer> CAND, Collection<Integer> FINI) throws IOException {
if (CAND.isEmpty() && FINI.isEmpty()) {
count.incrementAndGet();
//if (count.get() % 100000000 == 0)
// System.out.println(count.get());
count.incrementAndGet();
return;
}
if(CAND.isEmpty() && !FINI.isEmpty())
return;
int u = find_u(CAND, FINI);
Collection<Integer> NghOfu = Ngh(G, u);
List<Integer> Ext = new ArrayList<>();
Map<Integer, Integer> Ext = new HashMap<>();
int[] ExtForFini = new int[CAND.size()];
for(int w : CAND){
int index = 0;
for (int w : CAND) {
if (!NghOfu.contains(w)) {
Ext.add(w);
Ext.put(w, index);
ExtForFini[index] = w;
index++;
}
}
int size = Ext.size();
if (size > 0) {
IntStream.range(0, size).parallel().forEach(i -> {
//long start = System.currentTimeMillis();
Ext.keySet().parallelStream().forEach(q -> {
int q = Ext.get(i);
int idx = Ext.get(q);
TreeSet<Integer> Kq = new TreeSet<>();
Kq.addAll(K);
Kq.add(q);
Collection<Integer> NghOfq = Ngh(G, q);
HashSet<Integer> CANDq = SetOperations.intersect(CAND, NghOfq);
//Collection<Integer> CANDq = SetOperations.parIntersect(CAND, NghOfq);
Collection<Integer> CANDq = computeNewCand(CAND, NghOfq, Ext, idx);
Collection<Integer> FINIq = computeNewFini(FINI, NghOfq, Ext, ExtForFini, idx);
HashSet<Integer> FINIq = SetOperations.intersect(FINI, NghOfq);
//Collection<Integer> FINIq = SetOperations.parIntersect(FINI, NghOfq);
// loopoverhead += (System.currentTimeMillis() - start);
for (int j = 0; j < i; j++) {
int p = Ext.get(j);
CANDq.remove(p);
if (NghOfq.contains(p))
FINIq.add(p);
}
//loopoverhead += (System.currentTimeMillis() - start);
// loopoverhead.addAndGet(delta);
try {
expand(Kq, CANDq, FINIq);
......@@ -146,6 +138,59 @@ public class perVertexParMCE_Total {
}
}
private Collection<Integer> computeNewFini(Collection<Integer> fini, Collection<Integer> nghOfq,
Map<Integer, Integer> ext, int[] extforfini, int idx) {
Collection<Integer> R = new HashSet<>();
if (2 * nghOfq.size() < fini.size() + idx) {
for (int w : nghOfq) {
if (fini.contains(w)) {
R.add(w);
}
if ((ext.get(w) < idx) && ext.containsKey(w))
R.add(w);
}
}
else {
for (int w : fini) {
if (nghOfq.contains(w))
R.add(w);
}
for(int i=0; i < idx; i++){
int x = extforfini[i];
if(nghOfq.contains(x))
R.add(x);
}
}
return R;
}
private Collection<Integer> computeNewCand(Collection<Integer> cand, Collection<Integer> nghOfq,
Map<Integer, Integer> ext, int idx) {
Collection<Integer> R = new HashSet<>();
if (cand.size() > nghOfq.size()) {
for (int w : nghOfq) {
if (cand.contains(w)) {
if (ext.containsKey(w) && (ext.get(w) > idx))
R.add(w);
if (!ext.containsKey(w))
R.add(w);
}
}
} else {
for (int w : cand) {
if (nghOfq.contains(w)) {
if (ext.containsKey(w) && (ext.get(w) > idx))
R.add(w);
if (!ext.containsKey(w))
R.add(w);
}
}
}
return R;
}
/*
* public Set<Integer> Ngh(int u) { return G.AdjList.get(u); }
*/
......
......@@ -68,15 +68,12 @@ public class perVertexParTTT_Total {
e.printStackTrace();
}
});
}
public void expand(TreeSet<Integer> K, Collection<Integer> CAND, Collection<Integer> FINI) throws IOException {
if (CAND.isEmpty() && FINI.isEmpty()) {
count.incrementAndGet();
count.incrementAndGet();
return;
}
if(CAND.isEmpty() && !FINI.isEmpty())
......@@ -84,44 +81,38 @@ public class perVertexParTTT_Total {
int u = find_u(CAND, FINI);
Collection<Integer> NghOfu = Ngh(G, u);
//List<Integer> Ext = new ArrayList<>();
int[] Ext = new int[CAND.size()];
Map<Integer, Integer> Ext = new HashMap<>();
int[] ExtForFini = new int[CAND.size()];
int index = 0;
for(int w : CAND){
for (int w : CAND) {
if (!NghOfu.contains(w)) {
Ext[index++] = w;
Ext.put(w, index);
ExtForFini[index] = w;
index++;
}
}
int size = index;
int size = Ext.size();
if (size > 0) {
IntStream.range(0, size).parallel().forEach(i -> {
Ext.keySet().parallelStream().forEach(q -> {
int q = Ext[i];
int idx = Ext.get(q);
TreeSet<Integer> Kq = new TreeSet<>();
Kq.addAll(K);
Kq.add(q);
Collection<Integer> NghOfq = Ngh(G, q);
HashSet<Integer> CANDq = SetOperations.intersect(CAND, NghOfq);
Collection<Integer> CANDq = computeNewCand(CAND, NghOfq, Ext, idx);
Collection<Integer> FINIq = computeNewFini(FINI, NghOfq, Ext, ExtForFini, idx);
HashSet<Integer> FINIq = SetOperations.intersect(FINI, NghOfq);
// loopoverhead += (System.currentTimeMillis() - start);
for (int j = 0; j < i; j++) {
int p = Ext[j];
CANDq.remove(p);
if (NghOfq.contains(p))
FINIq.add(p);
}
// loopoverhead.addAndGet(delta);
try {
expand(Kq, CANDq, FINIq);
......@@ -134,6 +125,58 @@ public class perVertexParTTT_Total {
}
}
private Collection<Integer> computeNewFini(Collection<Integer> fini, Collection<Integer> nghOfq,
Map<Integer, Integer> ext, int[] extforfini, int idx) {
Collection<Integer> R = new HashSet<>();
if (2 * nghOfq.size() < fini.size() + idx) {
for (int w : nghOfq) {
if (fini.contains(w)) {
R.add(w);
}
if ((ext.get(w) < idx) && ext.containsKey(w))
R.add(w);
}
}
else {
for (int w : fini) {
if (nghOfq.contains(w))
R.add(w);
}
for(int i=0; i < idx; i++){
int x = extforfini[i];
if(nghOfq.contains(x))
R.add(x);
}
}
return R;
}
private Collection<Integer> computeNewCand(Collection<Integer> cand, Collection<Integer> nghOfq,
Map<Integer, Integer> ext, int idx) {
Collection<Integer> R = new HashSet<>();
if (cand.size() > nghOfq.size()) {
for (int w : nghOfq) {
if (cand.contains(w)) {
if (ext.containsKey(w) && (ext.get(w) > idx))
R.add(w);
if (!ext.containsKey(w))
R.add(w);
}
}
} else {
for (int w : cand) {
if (nghOfq.contains(w)) {
if (ext.containsKey(w) && (ext.get(w) > idx))
R.add(w);
if (!ext.containsKey(w))
R.add(w);
}
}
}
return R;
}
public Collection<Integer> Ngh(Graph G, int u) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment