]> granicus.if.org Git - graphviz/commitdiff
sfdpgen: remove 'PriorityQueue' code
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 30 Dec 2022 17:44:06 +0000 (09:44 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 19:54:49 +0000 (11:54 -0800)
The last use of this was removed in d42aea4877c8ff9ea0d1cc4f23b45f2d1b958622.

ci/clang_format.py
cmd/gvmap/country_graph_coloring.c
lib/sfdpgen/CMakeLists.txt
lib/sfdpgen/Makefile.am
lib/sfdpgen/Multilevel.c
lib/sfdpgen/PriorityQueue.c [deleted file]
lib/sfdpgen/PriorityQueue.h [deleted file]
lib/sfdpgen/sfdp.vcxproj
lib/sfdpgen/sfdp.vcxproj.filters

index c52102ef684f8d19641e420595cb255fbd7934db..84788a23a7e68417d803249a73a4c579f873a5c2 100644 (file)
@@ -518,8 +518,6 @@ EXCLUDE = (
   "lib/rbtree/test_red_black_tree.c",
   "lib/sfdpgen/Multilevel.c",
   "lib/sfdpgen/Multilevel.h",
-  "lib/sfdpgen/PriorityQueue.c",
-  "lib/sfdpgen/PriorityQueue.h",
   "lib/sfdpgen/post_process.c",
   "lib/sfdpgen/post_process.h",
   "lib/sfdpgen/sfdp.h",
index f5ad497e582941c66c659e06e474b1ecbf896af4..6a44c4cfe5db92e6ef312b071dab8191b499dab9 100644 (file)
@@ -12,8 +12,6 @@
 #include "country_graph_coloring.h"
 #include <math.h>
 #include "power.h"
-
-#include <sfdpgen/PriorityQueue.h>
 #include <stdbool.h>
 #include <time.h>
 
index a562422e493270c02e27447e84f4a1b33b0f20f9..493699af9885a93536f2f71a36c395130741cbd5 100644 (file)
@@ -6,7 +6,6 @@ add_library(sfdpgen STATIC
   # Header files
   Multilevel.h
   post_process.h
-  PriorityQueue.h
   sfdp.h
   sfdpinternal.h
   sparse_solve.h
@@ -17,7 +16,6 @@ add_library(sfdpgen STATIC
   # Source files
   Multilevel.c
   post_process.c
-  PriorityQueue.c
   sfdpinit.c
   sparse_solve.c
   spring_electrical.c
index 5bfaa72bc55cfb342f233a94d160f8f6e25b6195..1677b7702b99da75f48b772bac491a5cd311c5ee 100644 (file)
@@ -16,7 +16,7 @@ endif
 noinst_HEADERS = sfdpinternal.h spring_electrical.h \
        sparse_solve.h post_process.h \
        stress_model.h uniform_stress.h \
-       Multilevel.h sfdp.h PriorityQueue.h
+       Multilevel.h sfdp.h
 
 if WITH_SFDP
 noinst_LTLIBRARIES = libsfdpgen_C.la
@@ -25,6 +25,6 @@ endif
 libsfdpgen_C_la_SOURCES = sfdpinit.c spring_electrical.c \
        sparse_solve.c post_process.c \
        stress_model.c uniform_stress.c \
-       Multilevel.c PriorityQueue.c
+       Multilevel.c
 
 EXTRA_DIST = sfdp.vcxproj*
index 1bc2e6fd5c853b42f4bc5ddf5c4652cec54803ab..440d0bd665fc0f0e8441201079d3d1bb5f7d3462 100644 (file)
@@ -9,7 +9,6 @@
  *************************************************************************/
 
 #include <sfdpgen/Multilevel.h>
-#include <sfdpgen/PriorityQueue.h>
 #include <assert.h>
 #include <cgraph/alloc.h>
 #include <common/arith.h>
diff --git a/lib/sfdpgen/PriorityQueue.c b/lib/sfdpgen/PriorityQueue.c
deleted file mode 100644 (file)
index b56d65c..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Details at https://graphviz.org
- *************************************************************************/
-
-#include <sparse/LinkedList.h>
-#include <sfdpgen/PriorityQueue.h>
-#include <common/memory.h>
-#include <assert.h>
-#include <common/arith.h>
-#include <stddef.h>
-
-PriorityQueue PriorityQueue_new(int n, int ngain){
-  PriorityQueue q;
-  int i;
-  q = N_GNEW(1,struct PriorityQueue_struct);
-  q->count = 0;
-  q->n = n;
-  q->ngain = ngain;
-  q->gain_max = -1;/* no entries yet */
-  q->buckets = N_GNEW((ngain+1),DoubleLinkedList);
-  for (i = 0; i < ngain+1; i++) (q->buckets)[i] = NULL;
-
-  q->where = N_GNEW((n+1),DoubleLinkedList);
-  for (i = 0; i < n+1; i++) (q->where)[i] = NULL;
-
-  q->gain = N_GNEW((n+1),int);
-  for (i = 0; i < n+1; i++) (q->gain)[i] = -999;
-  return q;
-
-}
-
-void PriorityQueue_delete(PriorityQueue q){
-  int i;
-
-  if (q){
-    if (q->buckets){
-      for (i = 0; i < q->ngain+1; i++) DoubleLinkedList_delete((q->buckets)[i], free);
-      free(q->buckets);
-    }
-
-    free(q->where);
-
-    free(q->gain);
-    free(q);
-  }
-}
-
-PriorityQueue PriorityQueue_push(PriorityQueue q, int i, int gain){
-  DoubleLinkedList l;
-  int *data, gainold;
-
-  assert(q);
-  assert(gain <= q->ngain);
-
-
-  if (!(q->where)[i]){
-    /* this entry is no in the queue yet, so this is a new addition */
-
-    (q->count)++;
-    if (gain > q->gain_max) q->gain_max = gain;
-    q->gain[i] = gain;
-
-    data = N_GNEW(1,int);
-    data[0] = i;
-    if ((l = (q->buckets)[gain])){
-      (q->buckets)[gain] = (q->where)[i] = DoubleLinkedList_prepend(l, data);
-    } else {
-      (q->buckets)[gain] = (q->where)[i] = DoubleLinkedList_new(data);
-    }
-
-  } else {
-    /* update gain for an exisiting entry */
-    l = q->where[i];
-    gainold = q->gain[i];
-    q->where[i] = NULL; 
-    (q->count)--;
-    DoubleLinkedList_delete_element(l, free, &((q->buckets)[gainold]));
-    return PriorityQueue_push(q, i, gain);
-  }
-  return q;
-}
-
-int PriorityQueue_pop(PriorityQueue q, int *i, int *gain){
-  int gain_max;
-  DoubleLinkedList l;
-  int *data;
-
-  if (!q || q->count <= 0) return 0;
-  *gain = gain_max = q->gain_max;
-  (q->count)--;
-  l = (q->buckets)[gain_max];
-  data = DoubleLinkedList_get_data(l);
-  *i = data[0];
-
-  DoubleLinkedList_delete_element(l, free, &((q->buckets)[gain_max]));
-  if (!(q->buckets)[gain_max]){/* the bin that contain the best gain is empty now after poping */
-    while (gain_max >= 0 && !(q->buckets)[gain_max]) gain_max--;
-    q->gain_max = gain_max;
-  }
-  q->where[*i] = NULL;
-  q->gain[*i] = -999;
-  return 1;
-}
-
-
-
-
-int PriorityQueue_get_gain(PriorityQueue q, int i){
-  return q->gain[i];
-}
-
-int PriorityQueue_remove(PriorityQueue q, int i){
-  /* remove an entry from the queue. If error, return 0. */
-  int gain, gain_max;
-  DoubleLinkedList l;
-
-  if (!q || q->count <= 0) return 0;
-  gain = q->gain[i];
-  (q->count)--;
-  l = (q->where)[i];
-
-  DoubleLinkedList_delete_element(l, free, &((q->buckets)[gain]));
-
-  if (gain == (gain_max = q->gain_max) && !(q->buckets)[gain_max]){/* the bin that contain the best gain is empty now after poping */
-    while (gain_max >= 0 && !(q->buckets)[gain_max]) gain_max--;
-    q->gain_max = gain_max;
-  }
-  q->where[i] = NULL;
-  q->gain[i] = -999;
-  return 1;
-}
-
-/*
-
-main(){
-  int i, gain;
-
-    
-    PriorityQueue q;
-    q = PriorityQueue_new(10,100);
-    PriorityQueue_push(q, 3, 1);
-    PriorityQueue_push(q, 2, 2);
-    PriorityQueue_push(q, 4, 2);
-    PriorityQueue_push(q, 5, 2);
-    PriorityQueue_push(q, 1, 100);
-    PriorityQueue_push(q, 2,  1);
-    while (PriorityQueue_pop(q, &i, &gain)){
-      printf("i = %d gain = %d\n", i, gain);
-    }
-    
-    printf("=========\n");
-    PriorityQueue_push(q, 3, 1);
-    PriorityQueue_push(q, 2, 2);
-    PriorityQueue_push(q, 4, 2);
-    PriorityQueue_push(q, 5, 2);
-    PriorityQueue_push(q, 1, 100);
-    PriorityQueue_push(q, 2,  1);
-    PriorityQueue_push(q, 2,  100);
-    while (PriorityQueue_pop(q, &i, &gain)){
-      printf("i = %d gain = %d\n", i, gain);
-    }
-
-
-    printf("====after removing 3 and 2 =====\n");
-    PriorityQueue_push(q, 3, 1);
-    PriorityQueue_push(q, 2, 2);
-    PriorityQueue_push(q, 4, 2);
-    PriorityQueue_push(q, 5, 2);
-    PriorityQueue_push(q, 1, 100);
-    PriorityQueue_push(q, 2,  1);
-    PriorityQueue_push(q, 2,  100);
-    PriorityQueue_remove(q, 3);
-    PriorityQueue_remove(q, 2);
-    while (PriorityQueue_pop(q, &i, &gain)){
-      printf("i = %d gain = %d\n", i, gain);
-    }
-    PriorityQueue_delete(q);
-
-}
-
-*/
diff --git a/lib/sfdpgen/PriorityQueue.h b/lib/sfdpgen/PriorityQueue.h
deleted file mode 100644 (file)
index 3a2d9fa..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#pragma once
-#include <sparse/LinkedList.h>
-struct PriorityQueue_struct {
-  /* a simple priority queue structure: entries are all integers, gains are all integers in [0, gainmax], total n elements */
-  int count;/* how many entries are in?*/
-
-  /* max index value of an entry */
-  int n;
-
-  /* only ngain buckets are allowed */
-  int ngain;
-
-  /* current highest gain */
-  int gain_max;
-
-  /* the ngain buckets. Each bucket i holds all entries with gain = i.*/
-  DoubleLinkedList *buckets;
-
-  /* a mapping which maps an entry's index to an element in a DoubleLinkedList */
-  DoubleLinkedList *where;
-
-  /* the gain of entry i is gain[i] */
-  int *gain;
-};
-
-typedef struct PriorityQueue_struct *PriorityQueue;
-
-
-PriorityQueue PriorityQueue_new(int n, int ngain);
-
-void PriorityQueue_delete(PriorityQueue q);
-
-/* if entry i is already in the list, then an update of gain is carried out*/
-PriorityQueue PriorityQueue_push(PriorityQueue q, int i, int gain);
-
-int PriorityQueue_pop(PriorityQueue q, int *i, int *gain);/* return 0 if nmothing left, 1 otherwise */
-
-int PriorityQueue_remove(PriorityQueue q, int i);/* return 0 if error */
-int PriorityQueue_get_gain(PriorityQueue q, int i);
index 923cc62711b525f8a561ed3afe2671f82266db65..d25f64448cc18e01ae88160abea394c80212638e 100644 (file)
@@ -80,7 +80,6 @@
   <ItemGroup>
     <ClCompile Include="Multilevel.c" />
     <ClCompile Include="post_process.c" />
-    <ClCompile Include="PriorityQueue.c" />
     <ClCompile Include="sfdpinit.c" />
     <ClCompile Include="sparse_solve.c" />
     <ClCompile Include="spring_electrical.c" />
index b9f507495a4d4c353e42b49b13a3017c72172fd8..abec0214bd31d99c3f940f45060ab4eb35e29c28 100644 (file)
@@ -26,9 +26,6 @@
     <ClCompile Include="post_process.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="PriorityQueue.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="sfdpinit.c">
       <Filter>Source Files</Filter>
     </ClCompile>