diff --git a/weighted_random_walk.ipynb b/weighted_random_walk.ipynb index 84cd602..6e3b1bd 100644 --- a/weighted_random_walk.ipynb +++ b/weighted_random_walk.ipynb @@ -6,7 +6,7 @@ "name": "weighted_random_walk.ipynb", "provenance": [], "collapsed_sections": [], - "authorship_tag": "ABX9TyMdSPfxyctAhjlb3X6mFu53", + "authorship_tag": "ABX9TyMBp+SzPu2nWuplh3TilKQx", "include_colab_link": true }, "kernelspec": { @@ -77,8 +77,7 @@ " valid_walks = []\n", " while len(valid_walks) < n:\n", " walks = _g.random_walks(length, n, start_nodes=None)\n", - " types = [[graph.nodes[node]['type']\n", - " for node in walk]\n", + " types = [[graph.nodes[node]['type'] for node in walk]\n", " for walk in walks]\n", " walks = [walks[i].tolist()\n", " for i,t in enumerate(types)\n", @@ -101,61 +100,63 @@ "G.nodes[2]['type'] = 'construct'\n", "G.nodes[3]['type'] = 'construct'\n", "G.nodes[4]['type'] = 'construct'\n", + "# G[0][2]['weight'] = 10\n", "\n", "metapaths = [\n", " ['task', 'construct', 'task'],\n", " ['construct', 'task', 'construct'],\n", "]\n", "\n", - "weighted_metapath_random_walk(G, 30, 3, metapaths)" + "weighted_metapath_random_walk(G, 30, 3, metapaths)\n", + "# G.edges.data()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "3QWQH4Q1A2TU", - "outputId": "93b798ba-81f1-49de-f4f3-73446cc07038" + "outputId": "af4e7707-5119-49d2-9dbb-e0c06074bb03" }, - "execution_count": 31, + "execution_count": 45, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ - "[[0, 4, 1],\n", - " [1, 2, 0],\n", - " [0, 4, 1],\n", - " [2, 0, 4],\n", - " [2, 1, 4],\n", - " [2, 1, 3],\n", - " [4, 1, 2],\n", - " [3, 1, 4],\n", - " [2, 1, 4],\n", - " [3, 0, 2],\n", - " [2, 0, 4],\n", + "[[2, 0, 3],\n", + " [2, 0, 3],\n", + " [1, 3, 0],\n", + " [2, 0, 3],\n", " [4, 0, 2],\n", - " [2, 1, 4],\n", - " [4, 0, 3],\n", + " [3, 0, 2],\n", " [4, 1, 3],\n", - " [3, 1, 4],\n", + " [0, 3, 1],\n", " [3, 1, 2],\n", - " [3, 0, 4],\n", - " [4, 1, 3],\n", - " [2, 1, 3],\n", - " [4, 0, 3],\n", - " [4, 1, 2],\n", - " [2, 1, 4],\n", + " [2, 0, 3],\n", + " [2, 0, 3],\n", + " [0, 3, 1],\n", " [0, 2, 1],\n", + " [3, 0, 4],\n", + " [3, 0, 2],\n", + " [3, 0, 2],\n", + " [2, 0, 3],\n", + " [2, 0, 4],\n", + " [0, 3, 1],\n", " [1, 4, 0],\n", - " [2, 1, 4],\n", - " [0, 4, 1],\n", - " [3, 1, 4],\n", - " [4, 1, 2],\n", - " [0, 4, 1]]" + " [4, 0, 2],\n", + " [1, 2, 0],\n", + " [3, 0, 2],\n", + " [4, 0, 3],\n", + " [2, 0, 4],\n", + " [0, 2, 1],\n", + " [3, 0, 2],\n", + " [2, 0, 3],\n", + " [1, 2, 0],\n", + " [2, 0, 3]]" ] }, "metadata": {}, - "execution_count": 31 + "execution_count": 45 } ] }