Skip to content

Commit

Permalink
Merge e5a53f7 into 5bb8abd
Browse files Browse the repository at this point in the history
  • Loading branch information
MengLiuPurdue committed Oct 30, 2018
2 parents 5bb8abd + e5a53f7 commit 3a503eb
Show file tree
Hide file tree
Showing 9 changed files with 1,205 additions and 24,310 deletions.
19 changes: 15 additions & 4 deletions localgraphclustering/approximate_PageRank.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,26 @@ def approximate_PageRank(G,
elif method == "l1reg":
#print("Uses the Fast Iterative Soft Thresholding Algorithm (FISTA).")
# TODO fix the following warning
warnings.warn("The normalization of this routine hasn't been adjusted to the new system yet")
# warnings.warn("The normalization of this routine hasn't been adjusted to the new system yet")
if cpp:
if ys == None:
return proxl1PRaccel_cpp(G.ai, G.aj, G.adjacency_matrix.data, ref_nodes, G.d, G.d_sqrt, G.dn_sqrt, alpha = alpha,
p = proxl1PRaccel_cpp(G.ai, G.aj, G.adjacency_matrix.data, ref_nodes, G.d, G.d_sqrt, G.dn_sqrt, alpha = alpha,
rho = rho, epsilon = epsilon, maxiter = iterations, max_time = timeout)[2]
else:
return proxl1PRaccel_cpp(G.ai, G.aj, G.adjacency_matrix.data, ref_nodes, G.d, G.d_sqrt, G.dn_sqrt, y = ys, alpha = alpha,
p = proxl1PRaccel_cpp(G.ai, G.aj, G.adjacency_matrix.data, ref_nodes, G.d, G.d_sqrt, G.dn_sqrt, y = ys, alpha = alpha,
rho = rho, epsilon = epsilon, maxiter = iterations, max_time = timeout)[2]
else:
return fista_dinput_dense(ref_nodes, G, alpha = alpha, rho = rho, epsilon = epsilon, max_iter = iterations, max_time = timeout)
p = fista_dinput_dense(ref_nodes, G, alpha = alpha, rho = rho, epsilon = epsilon, max_iter = iterations, max_time = timeout)
# convert result to a sparse vector
nonzeros = np.count_nonzero(p)
idx = np.zeros(nonzeros,dtype=np.dtype(G.aj[0]))
vals = np.zeros(nonzeros,dtype=np.float64)
it = 0
for i in range(len(p)):
if p[i] != 0:
idx[it] = i
vals[it] = p[i]*1.0 * G.dn[i] if normalize else p[i]
it += 1
return (idx,vals)
else:
raise Exception("Unknown method, available methods are \"acl\" or \"acl_weighted\" or \"l1reg\".")
1 change: 0 additions & 1 deletion localgraphclustering/sweep_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
def sweep_cut(G: GraphLocal,
p: Union[Sequence[float],Tuple[Sequence[int],Sequence[float]]],
do_sort: bool = True,
normalized: bool = True,
cpp: bool = True):
"""
It implements a sweep cut rounding procedure for local graph clustering.
Expand Down
54 changes: 42 additions & 12 deletions notebooks/Helper-Example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from localgraphclustering import *\n",
"import sys,os\n",
"\n",
"try:\n",
" from localgraphclustering import *\n",
"except:\n",
" # when the package is not installed, import the local version instead. \n",
" # the notebook must be placed in the original \"notebooks/\" folder\n",
" sys.path.append(\"../\")\n",
" from localgraphclustering import *\n",
"import helper\n",
"\n",
"import numpy as np\n",
Expand All @@ -16,7 +26,9 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -77,63 +89,81 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
Expand Down
187 changes: 121 additions & 66 deletions notebooks/examples.ipynb

Large diffs are not rendered by default.

272 changes: 174 additions & 98 deletions notebooks/examples_Bioinformatics_with_visualization.ipynb

Large diffs are not rendered by default.

24,463 changes: 524 additions & 23,939 deletions notebooks/examples_with_visualization.ipynb

Large diffs are not rendered by default.

165 changes: 106 additions & 59 deletions notebooks/improveType_algorithms_with_visualization.ipynb

Large diffs are not rendered by default.

149 changes: 104 additions & 45 deletions notebooks/more_examples_with_visualization.ipynb

Large diffs are not rendered by default.

205 changes: 119 additions & 86 deletions notebooks/spectral_vs_flow_2_with_visualization.ipynb

Large diffs are not rendered by default.

0 comments on commit 3a503eb

Please sign in to comment.