{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"import pandas as pd\n",
|
|
"import numpy as np\n",
|
|
"import sys\n",
|
|
"sys.path.append('../../Scripts')\n",
|
|
"from preprocess_daily import DailyPreprocessor\n",
|
|
"from generate_signals import SignalGenerator"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"비보호좌회전, 신호우회전, 유턴\n",
|
|
"\n",
|
|
"줄임말 목록\n",
|
|
"- `i` : 교차로번호, `inter_no`\n",
|
|
"- `f` : 진입, from, `inc_edge_id`\n",
|
|
"- `t` : 진출, to, `out_edge_id`\n",
|
|
"- `vec` : 방향벡터, unit vector (`np.array([0.6, 0.8])`)\n",
|
|
"- `dire` : 방위, direction (동, 서, 남, 북, 북동, 북서, 남동, 남서)\n",
|
|
"- `rvec` : 정방향 방향벡터, unit vector to the right direction (`np.array([0,1])`)\n",
|
|
"\n",
|
|
"필요한 객체들 목록\n",
|
|
"\n",
|
|
"- `inter2dire2rvec` : `inter_no` $\\mapsto$ `dire2rvec`\n",
|
|
" - `dire2rvec` : `dire` $\\mapsto$ `rvec`\n",
|
|
"- `inter2incs` : `inter_no` $\\mapsto$ `inc_edge_ids`\n",
|
|
"- `inter2outs` : `inter_no` $\\mapsto$ `out_edge_ids`\n",
|
|
"- `inter2inc2dire` : `inter_no` $\\mapsto$ `int2dire`\n",
|
|
" - `inc2dire` : `out_edge_id` $\\mapsto$ `dire`\n",
|
|
"- `inter2out2dire` : `inter_no` $\\mapsto$ `out2dire`\n",
|
|
" - `out2dire` : `inc_edge_id` $\\mapsto$ `dire`\n",
|
|
"- `inter2inc2vec` : `inter_no` $\\mapsto$ `int2vec`\n",
|
|
" - `inc2vec` : `out_edge_id` $\\mapsto$ `vec`\n",
|
|
"- `inter2out2vec` : `inter_no` $\\mapsto$ `out2vec`\n",
|
|
" - `out2vec` : `inc_edge_id` $\\mapsto$ `vec`\n",
|
|
"\n",
|
|
"좌회전 판단\n",
|
|
"\n",
|
|
"Given `inter_no`, `inc_edge_id` and `out_edge_id`, we have `inc_vec = inter2inc2vec[inter_no][inc_edge_id]` and `out_vec = inter2out2vec[inter_no][out_edge_id]`.\n",
|
|
"Rotate `inc_vec` by 90, 180 and 270 degrees clockwise, to define \n",
|
|
"`out_vec_left`, `out_vec_straight` and `out_vec_right`.\n",
|
|
"Define `out_vecs={'right':out_vec_left, 'straight':out_vec_straight, 'right':out_vec_right}`.\n",
|
|
"Select the key that maximize the similarity of the corresponding value of the key and `inc_vec`."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"1. 데이터를 로드합니다.\n",
|
|
"1-1. 네트워크가 로드되었습니다.\n",
|
|
"1-2. 테이블들이 로드되었습니다.\n",
|
|
"1-3. 네트워크의 모든 clean state requirement들을 체크했습니다.\n",
|
|
"1-4. 테이블들의 무결성 검사를 완료했습니다.\n",
|
|
"1-5. 주요 객체 (리스트, 딕셔너리)들을 저장했습니다.\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>parent_id</th>\n",
|
|
" <th>child_id</th>\n",
|
|
" <th>adj_inc_edge_id</th>\n",
|
|
" <th>adj_out_edge_id</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>571500487_02</td>\n",
|
|
" <td>571500487_01.32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>i2</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>571542811_02</td>\n",
|
|
" <td>571542811_01</td>\n",
|
|
" <td>571542810_01.51</td>\n",
|
|
" <td>571542810_02</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>i3</td>\n",
|
|
" <td>u30</td>\n",
|
|
" <td>571556450_02</td>\n",
|
|
" <td>571556450_01</td>\n",
|
|
" <td>571556452_01</td>\n",
|
|
" <td>571556452_02</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>i3</td>\n",
|
|
" <td>u31</td>\n",
|
|
" <td>-571500475_01</td>\n",
|
|
" <td>571500475_01</td>\n",
|
|
" <td>571500475_02</td>\n",
|
|
" <td>571500475_01.26</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>i3</td>\n",
|
|
" <td>u32</td>\n",
|
|
" <td>571540303_02.21</td>\n",
|
|
" <td>571540303_01</td>\n",
|
|
" <td>571540303_02</td>\n",
|
|
" <td>-571540303_02</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>i6</td>\n",
|
|
" <td>u60</td>\n",
|
|
" <td>571500535_02.18</td>\n",
|
|
" <td>571500535_01</td>\n",
|
|
" <td>571500535_02</td>\n",
|
|
" <td>-571500535_02</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" parent_id child_id adj_inc_edge_id adj_out_edge_id inc_edge_id \\\n",
|
|
"0 i0 u00 -571500487_01 571500487_01 571500487_02 \n",
|
|
"1 i2 u20 571542811_02 571542811_01 571542810_01.51 \n",
|
|
"2 i3 u30 571556450_02 571556450_01 571556452_01 \n",
|
|
"3 i3 u31 -571500475_01 571500475_01 571500475_02 \n",
|
|
"4 i3 u32 571540303_02.21 571540303_01 571540303_02 \n",
|
|
"5 i6 u60 571500535_02.18 571500535_01 571500535_02 \n",
|
|
"\n",
|
|
" out_edge_id \n",
|
|
"0 571500487_01.32 \n",
|
|
"1 571542810_02 \n",
|
|
"2 571556452_02 \n",
|
|
"3 571500475_01.26 \n",
|
|
"4 -571540303_02 \n",
|
|
"5 -571500535_02 "
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"self = DailyPreprocessor()\n",
|
|
"self.load_data()\n",
|
|
"self.make_match1()\n",
|
|
"self.make_match2()\n",
|
|
"self.make_match3()\n",
|
|
"self.make_match4()\n",
|
|
"self.make_match5()\n",
|
|
"display(self.u_turn)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"self.u_turn = pd.merge(self.u_turn, self.u_condition, on='child_id')\n",
|
|
"\n",
|
|
"# p2inc_edge2angle : node_id to inc_edge2angle\n",
|
|
"p2inc_edge2angle = dict()\n",
|
|
"# p2out_edge2angle : node_id to out_edge2angle\n",
|
|
"p2out_edge2angle = dict()\n",
|
|
"# p2inc_angle2edge : node_id to inc_angle2edge\n",
|
|
"p2inc_angle2edge = dict()\n",
|
|
"# p2out_angle2edge : node_id to out_angle2edge\n",
|
|
"p2out_angle2edge = dict()\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" m5 = self.match5[self.match5.node_id==node_id]\n",
|
|
" m5 = m5.dropna(subset=['inc_edge_id', 'out_edge_id'])\n",
|
|
" # inc_edge2angle : inc_edge_id to inc_angle\n",
|
|
" inc_edge2angle = dict(zip(m5.inc_edge_id, m5.inc_angle.astype(int)))\n",
|
|
" p2inc_edge2angle[node_id] = inc_edge2angle\n",
|
|
" # out_edge2angle : out_edge_id to out_angle\n",
|
|
" out_edge2angle = dict(zip(m5.out_edge_id, m5.out_angle.astype(int)))\n",
|
|
" p2out_edge2angle[node_id] = out_edge2angle\n",
|
|
" # inc_angle2edge : inc_angle to inc_edge_id\n",
|
|
" inc_angle2edge = dict(zip(m5.inc_angle.astype(int), m5.inc_edge_id))\n",
|
|
" p2inc_angle2edge[node_id] = inc_angle2edge\n",
|
|
" # out_angle2edge : out_angle to out_edge_id\n",
|
|
" out_angle2edge = dict(zip(m5.out_angle.astype(int), m5.out_edge_id))\n",
|
|
" p2out_angle2edge[node_id] = out_angle2edge\n",
|
|
"\n",
|
|
"# 각 uturn node에 대하여 (inc_edge_id, out_edge_id) 부여\n",
|
|
"cmatches = []\n",
|
|
"for row in self.u_turn.itertuples():\n",
|
|
" parent_id = row.parent_id\n",
|
|
" child_id = row.child_id\n",
|
|
" condition = row.condition\n",
|
|
" inc_edge_id = row.inc_edge_id\n",
|
|
" out_edge_id = row.out_edge_id\n",
|
|
" adj_inc_edge_id = row.adj_inc_edge_id\n",
|
|
" adj_out_edge_id = row.adj_out_edge_id\n",
|
|
"\n",
|
|
" # match5에서 부모노드id에 해당하는 행들을 가져옴 (cmatch)\n",
|
|
" cmatch = self.match5.copy()[self.match5.node_id==parent_id] # match dataframe for a child node\n",
|
|
" cmatch = cmatch.sort_values(by=['phase_no', 'ring_type']).reset_index(drop=True)\n",
|
|
" cmatch['node_id'] = child_id\n",
|
|
"\n",
|
|
" # 진입엣지 각도\n",
|
|
" inc_angle = p2inc_edge2angle[parent_id][adj_inc_edge_id]\n",
|
|
"\n",
|
|
" # 이격각도\n",
|
|
" self.angle_separation = 10\n",
|
|
"\n",
|
|
" # 진입로 각도 목록\n",
|
|
" inc_angles = cmatch.dropna(subset=['inc_angle', 'out_angle']).inc_angle.astype(int).unique()\n",
|
|
" inc_angles = np.sort(inc_angles)\n",
|
|
" inc_angles = list(inc_angles - 360) + list(inc_angles) + list(inc_angles + 360)\n",
|
|
" inc_angles = np.array(inc_angles)\n",
|
|
"\n",
|
|
" # 보행신호시의 진입로 각도\n",
|
|
" inc_angles_left = inc_angles[inc_angles >= inc_angle + self.angle_separation]\n",
|
|
" inc_angle_pedes = np.sort(inc_angles_left)[0] % 360\n",
|
|
"\n",
|
|
" # 보행신호시의 진입로 엣지id\n",
|
|
" inc_angle2edge = p2inc_angle2edge[parent_id]\n",
|
|
" inc_edge_id_pedes = inc_angle2edge[inc_angle_pedes]\n",
|
|
"\n",
|
|
" # 진출로 각도 목록\n",
|
|
" out_angles = cmatch.dropna(subset=['inc_angle', 'out_angle']).out_angle.astype(int).unique()\n",
|
|
" out_angles = np.sort(out_angles)\n",
|
|
" out_angles = list(out_angles - 360) + list(out_angles) + list(out_angles + 360)\n",
|
|
" out_angles = np.array(out_angles)\n",
|
|
"\n",
|
|
" # 보행신호시의 진입로 각도\n",
|
|
" out_angles_right = out_angles[out_angles <= inc_angle - self.angle_separation]\n",
|
|
" out_angle_pedes = np.sort(out_angles_right)[-1] % 360\n",
|
|
"\n",
|
|
" # 보행신호시의 진입로 엣지id\n",
|
|
" out_angle2edge = p2out_angle2edge[parent_id]\n",
|
|
" out_edge_id_pedes = out_angle2edge[out_angle_pedes]\n",
|
|
"\n",
|
|
" # 진입엣지/진출엣지 포함 조건\n",
|
|
" inc_true = (cmatch.inc_edge_id==adj_inc_edge_id)\n",
|
|
" out_true = (cmatch.out_edge_id==adj_out_edge_id)\n",
|
|
"\n",
|
|
" # 보행신호시 조건\n",
|
|
" pedes_flag = (cmatch.inc_edge_id==inc_edge_id_pedes) & (cmatch.out_edge_id==out_edge_id_pedes)\n",
|
|
"\n",
|
|
" # 좌회전시 조건\n",
|
|
" right_flag = inc_true & (cmatch.turn_type=='left')\n",
|
|
"\n",
|
|
" # 보행신호이동류(17) 조건\n",
|
|
" crosswalk_on = (cmatch.move_no==17) & ~ out_true\n",
|
|
"\n",
|
|
" # 신호없음이동류(18) 조건\n",
|
|
" all_redsigns = (cmatch.move_no==18) & ~ out_true\n",
|
|
"\n",
|
|
" # 보행신호시/좌회전시 진입/진출 엣지id 배정\n",
|
|
" cmatch[['inc_edge_id', 'out_edge_id']] = np.nan\n",
|
|
" if condition == \"보행신호시\":\n",
|
|
" cmatch.loc[pedes_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n",
|
|
" elif condition == \"좌회전시\":\n",
|
|
" cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n",
|
|
"\n",
|
|
" uturn_not_assigned = cmatch[['inc_edge_id','out_edge_id']].isna().any(axis=1).all()\n",
|
|
"\n",
|
|
" if uturn_not_assigned:\n",
|
|
" # 보행신호시\n",
|
|
" if pedes_flag.any():\n",
|
|
" cmatch.loc[pedes_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n",
|
|
" # 좌회전시\n",
|
|
" elif right_flag.any():\n",
|
|
" cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n",
|
|
" # 보행신호이동류(17) 발생시\n",
|
|
" elif crosswalk_on.any():\n",
|
|
" cmatch.loc[crosswalk_on, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n",
|
|
" # 신호없음이동류(18) 발생시\n",
|
|
" elif all_redsigns.any():\n",
|
|
" cmatch.loc[all_redsigns, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n",
|
|
" # 진출엣지 미포함시\n",
|
|
" elif out_true.any():\n",
|
|
" cmatch.loc[~ out_true, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 38,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"self.match7 = self.match6.copy()\n",
|
|
"self.match7 = self.match7[['inter_no', 'move_no', 'inc_dire', 'out_dire', 'inc_edge_id', 'out_edge_id', 'node_id']]\n",
|
|
"\n",
|
|
"# (1) 가능한 (진입방향, 진출방향) 목록 \n",
|
|
"flows = self.nema.dropna().apply(lambda row: (row['inc_dire'], row['out_dire']), axis=1).tolist()\n",
|
|
"# (2) 각 교차로별 방향 목록 : pdires (possible directions)\n",
|
|
"pdires = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" dires = self.match7[self.match7.node_id == node_id][['inc_dire','out_dire']].values.flatten()\n",
|
|
" dires = {dire for dire in dires if type(dire)==str}\n",
|
|
" pdires[node_id] = dires\n",
|
|
"# (3) 각 (교차로, 진입방향) 별 진입id 목록 : inc2id (incoming direction to incoming edge_id)\n",
|
|
"inc2id = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" for inc_dire in pdires[node_id]:\n",
|
|
" df = self.match7[(self.match7.node_id==node_id) & (self.match7.inc_dire==inc_dire)]\n",
|
|
" inc2id[(node_id, inc_dire)] = df.inc_edge_id.iloc[0]\n",
|
|
"# (4) 각 (교차로, 진출방향) 별 진출id 목록 : out2id (outgoing direction to outgoing edge_id)\n",
|
|
"out2id = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" for out_dire in pdires[node_id]:\n",
|
|
" df = self.match7[(self.match7.node_id==node_id) & (self.match7.out_dire==out_dire)]\n",
|
|
" out2id[(node_id, out_dire)] = df.out_edge_id.iloc[0]\n",
|
|
"# (5) 각 교차로별 가능한 (진입방향, 진출방향) 목록 : pflow (possible flows)\n",
|
|
"pflow = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" pflow[node_id] = [flow for flow in flows if set(flow).issubset(pdires[node_id])]\n",
|
|
"# display(pflow)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>...</th>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>67</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>571511538_02.121</td>\n",
|
|
" <td>571500535_01</td>\n",
|
|
" <td>i6</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>68</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>571500535_02.18</td>\n",
|
|
" <td>571500585_01</td>\n",
|
|
" <td>i6</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>69</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>571500585_02</td>\n",
|
|
" <td>571542115_01</td>\n",
|
|
" <td>i6</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>70</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>-571542115_01</td>\n",
|
|
" <td>571511538_01</td>\n",
|
|
" <td>i6</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>71</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571500535_02</td>\n",
|
|
" <td>-571500535_02</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"<p>72 rows × 7 columns</p>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id \\\n",
|
|
"0 175 1 동 남 571545870_02 571542797_02 \n",
|
|
"1 175 2 서 동 571510153_02 571545870_01 \n",
|
|
"2 175 3 남 서 -571542797_02 571510153_01 \n",
|
|
"3 175 4 북 남 -571500487_01 571542797_02 \n",
|
|
"4 175 5 서 북 571510153_02 571500487_01 \n",
|
|
".. ... ... ... ... ... ... \n",
|
|
"67 210 21 북 서 571511538_02.121 571500535_01 \n",
|
|
"68 210 21 서 남 571500535_02.18 571500585_01 \n",
|
|
"69 210 21 남 동 571500585_02 571542115_01 \n",
|
|
"70 210 21 동 북 -571542115_01 571511538_01 \n",
|
|
"71 210 5 서 북 571500535_02 -571500535_02 \n",
|
|
"\n",
|
|
" node_id \n",
|
|
"0 i0 \n",
|
|
"1 i0 \n",
|
|
"2 i0 \n",
|
|
"3 i0 \n",
|
|
"4 i0 \n",
|
|
".. ... \n",
|
|
"67 i6 \n",
|
|
"68 i6 \n",
|
|
"69 i6 \n",
|
|
"70 i6 \n",
|
|
"71 u60 \n",
|
|
"\n",
|
|
"[72 rows x 7 columns]"
|
|
]
|
|
},
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.make_match6()\n",
|
|
"self.make_matching()\n",
|
|
"self.matching"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 54,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[('동', '남'), ('서', '동'), ('남', '서'), ('북', '남'), ('서', '북'), ('동', '서'), ('북', '동'), ('남', '북'), ('북동', '남동'), ('남서', '북동'), ('남동', '남서'), ('북서', '남동'), ('남서', '북서'), ('북동', '남서'), ('북서', '북동'), ('남동', '북서')]\n",
|
|
"{'i0': {'서', '북', '동', '남'}, 'i1': {'서', '북', '남'}, 'i2': {'북', '남'}, 'i3': {'서', '북', '동', '남'}, 'i6': {'북', '서', '동', '남'}, 'i7': {'북', '남'}, 'i8': {'서', '북', '동', '남'}, 'i9': {'서', '동'}}\n",
|
|
"{('i0', '서'): '571510153_02', ('i0', '북'): '-571500487_01', ('i0', '동'): '571545870_02', ('i0', '남'): '-571542797_02', ('i1', '서'): '571543469_02', ('i1', '북'): '571542797_02.99', ('i1', '남'): '-571542810_01', ('i2', '북'): '571542811_02', ('i2', '남'): '-571542809_01', ('i3', '서'): '571540303_02.21', ('i3', '북'): '571556450_02', ('i3', '동'): '-571500475_01', ('i3', '남'): '571540304_02', ('i6', '북'): '571511538_02.121', ('i6', '서'): '571500535_02.18', ('i6', '동'): '-571542115_01', ('i6', '남'): '571500585_02', ('i7', '북'): '571542073_01', ('i7', '남'): '-571511538_02', ('i8', '서'): '571500618_02', ('i8', '북'): '571500583_01', ('i8', '동'): '571500617_02', ('i8', '남'): '-571500569_01', ('i9', '서'): '571510152_01', ('i9', '동'): '571510152_02'}\n",
|
|
"{('i0', '서'): '571510153_01', ('i0', '북'): '571500487_01', ('i0', '동'): '571545870_01', ('i0', '남'): '571542797_02', ('i1', '서'): '571543469_01', ('i1', '북'): '-571542797_02.99', ('i1', '남'): '571542810_01', ('i2', '북'): '571542811_01', ('i2', '남'): '571542809_01', ('i3', '서'): '571540303_01', ('i3', '북'): '571556450_01', ('i3', '동'): '571500475_01', ('i3', '남'): '571540304_01', ('i6', '북'): '571511538_01', ('i6', '서'): '571500535_01', ('i6', '동'): '571542115_01', ('i6', '남'): '571500585_01', ('i7', '북'): '571542073_02', ('i7', '남'): '571511538_02', ('i8', '서'): '571500618_01', ('i8', '북'): '571500583_02', ('i8', '동'): '571500617_01', ('i8', '남'): '571500569_01', ('i9', '서'): '-571510152_01', ('i9', '동'): '571510152_01.65'}\n",
|
|
"{'i0': [('동', '남'), ('서', '동'), ('남', '서'), ('북', '남'), ('서', '북'), ('동', '서'), ('북', '동'), ('남', '북')], 'i1': [('남', '서'), ('북', '남'), ('서', '북'), ('남', '북')], 'i2': [('북', '남'), ('남', '북')], 'i3': [('동', '남'), ('서', '동'), ('남', '서'), ('북', '남'), ('서', '북'), ('동', '서'), ('북', '동'), ('남', '북')], 'i6': [('동', '남'), ('서', '동'), ('남', '서'), ('북', '남'), ('서', '북'), ('동', '서'), ('북', '동'), ('남', '북')], 'i7': [('북', '남'), ('남', '북')], 'i8': [('동', '남'), ('서', '동'), ('남', '서'), ('북', '남'), ('서', '북'), ('동', '서'), ('북', '동'), ('남', '북')], 'i9': [('서', '동'), ('동', '서')]}\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print(flows)\n",
|
|
"print(pdires)\n",
|
|
"print(inc2id)\n",
|
|
"print(out2id)\n",
|
|
"print(pflow)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# (6) 가능한 이동류에 대하여 진입id, 진출id 배정 : matching\n",
|
|
"dires_right = ['북', '북서', '서', '남서', '남', '남동', '동', '북동'] # ex (북, 서), (서, 남) 등은 우회전 flow\n",
|
|
"self.matching = []\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" inter_no = self.node2inter[node_id]\n",
|
|
" print(node_id, inter_no)\n",
|
|
" display(self.match6[self.match6.node_id==node_id])\n",
|
|
" # 좌회전과 직진(1 ~ 16)\n",
|
|
" for (inc_dire, out_dire) in pflow[node_id]:\n",
|
|
" move_no = self.nema[(self.nema.inc_dire==inc_dire) & (self.nema.out_dire==out_dire)].move_no.iloc[0]\n",
|
|
" inc_edge_id = inc2id[(node_id, inc_dire)]\n",
|
|
" out_edge_id = out2id[(node_id, out_dire)]\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no], 'move_no':[move_no],\n",
|
|
" 'inc_dire':[inc_dire], 'out_dire':[out_dire],\n",
|
|
" 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id], 'node_id':[node_id]})\n",
|
|
" display(new_row)\n",
|
|
" self.matching.append(new_row)\n",
|
|
" # 보행신호(17), 전적색(18)\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no] * 2, 'move_no':[17, 18],\n",
|
|
" 'inc_dire':[None]*2, 'out_dire':[None]*2,\n",
|
|
" 'inc_edge_id':[None]*2, 'out_edge_id':[None]*2, 'node_id':[node_id]*2})\n",
|
|
" display(new_row)\n",
|
|
" self.matching.append(new_row)\n",
|
|
" # 신호우회전(21)\n",
|
|
" for d in range(len(dires_right)):\n",
|
|
" inc_dire = dires_right[d]\n",
|
|
" out_dire = dires_right[(d+2)%8]\n",
|
|
" if {inc_dire, out_dire}.issubset(pdires[node_id]):\n",
|
|
" inc_edge_id = inc2id[(node_id, inc_dire)]\n",
|
|
" out_edge_id = out2id[(node_id, out_dire)]\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no], 'move_no':[21],\n",
|
|
" 'inc_dire':[inc_dire], 'out_dire':[out_dire],\n",
|
|
" 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id], 'node_id':[node_id]})\n",
|
|
" display(new_row)\n",
|
|
" self.matching.append(new_row)\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 79,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"self.match7 = self.match6.copy()\n",
|
|
"self.match7 = self.match7[['inter_no', 'move_no', 'inc_dire', 'out_dire', 'inc_edge_id', 'out_edge_id', 'node_id']]\n",
|
|
"\n",
|
|
"# (1) 가능한 (진입방향, 진출방향) 목록 \n",
|
|
"flows = self.nema.dropna().apply(lambda row: (row['inc_dire'], row['out_dire']), axis=1).tolist()\n",
|
|
"# (2) 각 교차로별 방향 목록 : pdires (possible directions)\n",
|
|
"pdires = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" dires = self.match7[self.match7.node_id == node_id][['inc_dire','out_dire']].values.flatten()\n",
|
|
" dires = {dire for dire in dires if type(dire)==str}\n",
|
|
" pdires[node_id] = dires\n",
|
|
"# (3) 각 (교차로, 진입방향) 별 진입id 목록 : inc2id (incoming direction to incoming edge_id)\n",
|
|
"inc2id = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" for inc_dire in pdires[node_id]:\n",
|
|
" df = self.match7[(self.match7.node_id==node_id) & (self.match7.inc_dire==inc_dire)]\n",
|
|
" inc2id[(node_id, inc_dire)] = df.inc_edge_id.iloc[0]\n",
|
|
"# (4) 각 (교차로, 진출방향) 별 진출id 목록 : out2id (outgoing direction to outgoing edge_id)\n",
|
|
"out2id = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" for out_dire in pdires[node_id]:\n",
|
|
" df = self.match7[(self.match7.node_id==node_id) & (self.match7.out_dire==out_dire)]\n",
|
|
" out2id[(node_id, out_dire)] = df.out_edge_id.iloc[0]\n",
|
|
"# (5) 각 교차로별 가능한 (진입방향, 진출방향) 목록 : pflow (possible flows)\n",
|
|
"pflow = {}\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" pflow[node_id] = [flow for flow in flows if set(flow).issubset(pdires[node_id])]\n",
|
|
"# (6) 가능한 이동류에 대하여 진입id, 진출id 배정 : matching\n",
|
|
"# node2inter = dict(zip(self.match7['node_id'], self.match7['inter_no']))\n",
|
|
"dires_right = ['북', '서', '남', '동', '북'] # ex (북, 서), (서, 남) 등은 우회전 flow\n",
|
|
"self.matching = []\n",
|
|
"for node_id in self.parent_ids:\n",
|
|
" inter_no = self.node2inter[node_id]\n",
|
|
" # 좌회전과 직진(1 ~ 16)\n",
|
|
" for (inc_dire, out_dire) in pflow[node_id]:\n",
|
|
" move_no = self.nema[(self.nema.inc_dire==inc_dire) & (self.nema.out_dire==out_dire)].move_no.iloc[0]\n",
|
|
" inc_edge_id = inc2id[(node_id, inc_dire)]\n",
|
|
" out_edge_id = out2id[(node_id, out_dire)]\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no], 'move_no':[move_no],\n",
|
|
" 'inc_dire':[inc_dire], 'out_dire':[out_dire],\n",
|
|
" 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id], 'node_id':[node_id]})\n",
|
|
" self.matching.append(new_row)\n",
|
|
" # 보행신호(17), 전적색(18)\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no] * 2, 'move_no':[17, 18],\n",
|
|
" 'inc_dire':[None]*2, 'out_dire':[None]*2,\n",
|
|
" 'inc_edge_id':[None]*2, 'out_edge_id':[None]*2, 'node_id':[node_id]*2})\n",
|
|
" self.matching.append(new_row)\n",
|
|
" # 신호우회전(21)\n",
|
|
" for d in range(len(dires_right)-1):\n",
|
|
" inc_dire = dires_right[d]\n",
|
|
" out_dire = dires_right[d+1]\n",
|
|
" if {inc_dire, out_dire}.issubset(pdires[node_id]):\n",
|
|
" inc_edge_id = inc2id[(node_id, inc_dire)]\n",
|
|
" out_edge_id = out2id[(node_id, out_dire)]\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no], 'move_no':[21],\n",
|
|
" 'inc_dire':[inc_dire], 'out_dire':[out_dire],\n",
|
|
" 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id], 'node_id':[node_id]})\n",
|
|
" self.matching.append(new_row)\n",
|
|
"self.matching.append(self.match7[self.match7.node_id.isin(self.child_ids)])\n",
|
|
"self.matching = pd.concat(self.matching)\n",
|
|
"self.matching = self.matching.dropna().sort_values(by=['inter_no', 'node_id', 'move_no']).reset_index(drop=True)\n",
|
|
"self.matching['move_no'] = self.matching['move_no'].astype(int)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>phase_no</th>\n",
|
|
" <th>ring_type</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_angle</th>\n",
|
|
" <th>out_angle</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" <th>turn_type</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>179</td>\n",
|
|
" <td>000</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>001</td>\n",
|
|
" <td>180</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>001</td>\n",
|
|
" <td>090</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>179</td>\n",
|
|
" <td>270</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>090</td>\n",
|
|
" <td>270</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>090</td>\n",
|
|
" <td>180</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>270</td>\n",
|
|
" <td>000</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>270</td>\n",
|
|
" <td>090</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>8</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>001</td>\n",
|
|
" <td>090</td>\n",
|
|
" <td>571500487_02</td>\n",
|
|
" <td>571500487_01.32</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no phase_no ring_type move_no inc_dire out_dire inc_angle \\\n",
|
|
"0 175 1 A 8 남 북 179 \n",
|
|
"1 175 1 B 4 북 남 001 \n",
|
|
"2 175 2 A 7 북 동 001 \n",
|
|
"3 175 2 B 3 남 서 179 \n",
|
|
"4 175 3 A 6 동 서 090 \n",
|
|
"5 175 3 B 1 동 남 090 \n",
|
|
"6 175 4 A 5 서 북 270 \n",
|
|
"7 175 4 B 2 서 동 270 \n",
|
|
"8 175 2 A 7 북 동 001 \n",
|
|
"\n",
|
|
" out_angle inc_edge_id out_edge_id node_id turn_type \n",
|
|
"0 000 -571542797_02 571500487_01 i0 straight \n",
|
|
"1 180 -571500487_01 571542797_02 i0 straight \n",
|
|
"2 090 -571500487_01 571545870_01 i0 left \n",
|
|
"3 270 -571542797_02 571510153_01 i0 left \n",
|
|
"4 270 571545870_02 571510153_01 i0 straight \n",
|
|
"5 180 571545870_02 571542797_02 i0 left \n",
|
|
"6 000 571510153_02 571500487_01 i0 left \n",
|
|
"7 090 571510153_02 571545870_01 i0 straight \n",
|
|
"8 090 571500487_02 571500487_01.32 u00 left "
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>8</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>9</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>10</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>11</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>21</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>12</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>571500487_02</td>\n",
|
|
" <td>571500487_01.32</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id \\\n",
|
|
"0 175 1 동 남 571545870_02 571542797_02 \n",
|
|
"1 175 2 서 동 571510153_02 571545870_01 \n",
|
|
"2 175 3 남 서 -571542797_02 571510153_01 \n",
|
|
"3 175 4 북 남 -571500487_01 571542797_02 \n",
|
|
"4 175 5 서 북 571510153_02 571500487_01 \n",
|
|
"5 175 6 동 서 571545870_02 571510153_01 \n",
|
|
"6 175 7 북 동 -571500487_01 571545870_01 \n",
|
|
"7 175 8 남 북 -571542797_02 571500487_01 \n",
|
|
"8 175 21 북 서 -571500487_01 571510153_01 \n",
|
|
"9 175 21 서 남 571510153_02 571542797_02 \n",
|
|
"10 175 21 남 동 -571542797_02 571545870_01 \n",
|
|
"11 175 21 동 북 571545870_02 571500487_01 \n",
|
|
"12 175 7 북 동 571500487_02 571500487_01.32 \n",
|
|
"\n",
|
|
" node_id \n",
|
|
"0 i0 \n",
|
|
"1 i0 \n",
|
|
"2 i0 \n",
|
|
"3 i0 \n",
|
|
"4 i0 \n",
|
|
"5 i0 \n",
|
|
"6 i0 \n",
|
|
"7 i0 \n",
|
|
"8 i0 \n",
|
|
"9 i0 \n",
|
|
"10 i0 \n",
|
|
"11 i0 \n",
|
|
"12 u00 "
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.make_matching()\n",
|
|
"match6 = self.match6.dropna().reset_index(drop=True)\n",
|
|
"matching = self.matching\n",
|
|
"display(match6[match6.inter_no==175])\n",
|
|
"display(matching[matching.inter_no==175])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 36,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"['i0', 'i1', 'i2', 'i3', 'i6', 'i7', 'i8', 'i9']"
|
|
]
|
|
},
|
|
"execution_count": 36,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.parent_ids"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 50,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>202</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>571510152_01</td>\n",
|
|
" <td>571510152_01.65</td>\n",
|
|
" <td>i9</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id node_id\n",
|
|
"0 202 2 서 동 571510152_01 571510152_01.65 i9"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>202</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>571510152_02</td>\n",
|
|
" <td>-571510152_01</td>\n",
|
|
" <td>i9</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id node_id\n",
|
|
"0 202 6 동 서 571510152_02 -571510152_01 i9"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"node_id = self.parent_ids[7]\n",
|
|
"inter_no = self.node2inter[node_id]\n",
|
|
"for (inc_dire, out_dire) in pflow[node_id]:\n",
|
|
" move_no = self.nema[(self.nema.inc_dire==inc_dire) & (self.nema.out_dire==out_dire)].move_no.iloc[0]\n",
|
|
" inc_edge_id = inc2id[(node_id, inc_dire)]\n",
|
|
" out_edge_id = out2id[(node_id, out_dire)]\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no], 'move_no':[move_no],\n",
|
|
" 'inc_dire':[inc_dire], 'out_dire':[out_dire],\n",
|
|
" 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id], 'node_id':[node_id]})\n",
|
|
" display(new_row)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 58,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>phase_no</th>\n",
|
|
" <th>ring_type</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_angle</th>\n",
|
|
" <th>out_angle</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" <th>turn_type</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>26</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>179</td>\n",
|
|
" <td>000</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>27</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>000</td>\n",
|
|
" <td>180</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>28</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>17</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542810_01.51</td>\n",
|
|
" <td>571542810_02</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>29</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>18</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no phase_no ring_type move_no inc_dire out_dire inc_angle \\\n",
|
|
"26 177 1 A 8 남 북 179 \n",
|
|
"27 177 1 B 4 북 남 000 \n",
|
|
"28 177 2 A 17 NaN NaN NaN \n",
|
|
"29 177 2 B 18 NaN NaN NaN \n",
|
|
"\n",
|
|
" out_angle inc_edge_id out_edge_id node_id turn_type \n",
|
|
"26 000 NaN NaN u20 straight \n",
|
|
"27 180 NaN NaN u20 straight \n",
|
|
"28 NaN 571542810_01.51 571542810_02 u20 NaN \n",
|
|
"29 NaN NaN NaN u20 NaN "
|
|
]
|
|
},
|
|
"execution_count": 58,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.match6[self.match6.node_id=='u20']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>8</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>9</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>10</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>571500487_02</td>\n",
|
|
" <td>571500487_01.32</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>11</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>12</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>13</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>14</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>15</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>26</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u20</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>27</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u20</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>28</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>17</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542810_01.51</td>\n",
|
|
" <td>571542810_02</td>\n",
|
|
" <td>u20</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>29</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>18</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u20</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>30</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>31</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>32</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_01</td>\n",
|
|
" <td>-571542116_02.96</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>33</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_02.96</td>\n",
|
|
" <td>571542116_02.164</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>34</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_01</td>\n",
|
|
" <td>-571542116_02.96</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>35</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_02.96</td>\n",
|
|
" <td>571542116_02.164</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>36</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_01</td>\n",
|
|
" <td>-571542116_02.96</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>37</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_02.96</td>\n",
|
|
" <td>571542116_02.164</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>46</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>47</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>48</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>49</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>50</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>51</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>52</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>571556452_01</td>\n",
|
|
" <td>571556452_02</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>53</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>54</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571500475_02</td>\n",
|
|
" <td>571500475_01.26</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>55</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>56</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>57</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>58</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>59</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>60</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>61</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>62</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>63</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>571540303_02</td>\n",
|
|
" <td>-571540303_02</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>64</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>65</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>66</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>67</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>68</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>69</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>100</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>101</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>18</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>102</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571500535_02</td>\n",
|
|
" <td>-571500535_02</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>103</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>104</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>105</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>106</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>107</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id \\\n",
|
|
"8 175 8 남 북 NaN NaN \n",
|
|
"9 175 4 북 남 NaN NaN \n",
|
|
"10 175 7 북 동 571500487_02 571500487_01.32 \n",
|
|
"11 175 3 남 서 NaN NaN \n",
|
|
"12 175 6 동 서 NaN NaN \n",
|
|
"13 175 1 동 남 NaN NaN \n",
|
|
"14 175 5 서 북 NaN NaN \n",
|
|
"15 175 2 서 동 NaN NaN \n",
|
|
"26 177 8 남 북 NaN NaN \n",
|
|
"27 177 4 북 남 NaN NaN \n",
|
|
"28 177 17 NaN NaN 571542810_01.51 571542810_02 \n",
|
|
"29 177 18 NaN NaN NaN NaN \n",
|
|
"30 178 20 NaN NaN NaN NaN \n",
|
|
"31 178 20 NaN NaN NaN NaN \n",
|
|
"32 178 20 NaN NaN 571542116_01 -571542116_02.96 \n",
|
|
"33 178 20 NaN NaN 571542116_02.96 571542116_02.164 \n",
|
|
"34 178 20 NaN NaN 571542116_01 -571542116_02.96 \n",
|
|
"35 178 20 NaN NaN 571542116_02.96 571542116_02.164 \n",
|
|
"36 178 20 NaN NaN 571542116_01 -571542116_02.96 \n",
|
|
"37 178 20 NaN NaN 571542116_02.96 571542116_02.164 \n",
|
|
"46 178 8 남 북 NaN NaN \n",
|
|
"47 178 4 북 남 NaN NaN \n",
|
|
"48 178 7 북 동 NaN NaN \n",
|
|
"49 178 3 남 서 NaN NaN \n",
|
|
"50 178 5 서 북 NaN NaN \n",
|
|
"51 178 2 서 동 NaN NaN \n",
|
|
"52 178 6 동 서 571556452_01 571556452_02 \n",
|
|
"53 178 1 동 남 NaN NaN \n",
|
|
"54 178 8 남 북 571500475_02 571500475_01.26 \n",
|
|
"55 178 4 북 남 NaN NaN \n",
|
|
"56 178 7 북 동 NaN NaN \n",
|
|
"57 178 3 남 서 NaN NaN \n",
|
|
"58 178 5 서 북 NaN NaN \n",
|
|
"59 178 2 서 동 NaN NaN \n",
|
|
"60 178 6 동 서 NaN NaN \n",
|
|
"61 178 1 동 남 NaN NaN \n",
|
|
"62 178 8 남 북 NaN NaN \n",
|
|
"63 178 4 북 남 571540303_02 -571540303_02 \n",
|
|
"64 178 7 북 동 NaN NaN \n",
|
|
"65 178 3 남 서 NaN NaN \n",
|
|
"66 178 5 서 북 NaN NaN \n",
|
|
"67 178 2 서 동 NaN NaN \n",
|
|
"68 178 6 동 서 NaN NaN \n",
|
|
"69 178 1 동 남 NaN NaN \n",
|
|
"100 210 6 동 서 NaN NaN \n",
|
|
"101 210 18 NaN NaN NaN NaN \n",
|
|
"102 210 5 서 북 571500535_02 -571500535_02 \n",
|
|
"103 210 2 서 동 NaN NaN \n",
|
|
"104 210 7 북 동 NaN NaN \n",
|
|
"105 210 4 북 남 NaN NaN \n",
|
|
"106 210 8 남 북 NaN NaN \n",
|
|
"107 210 3 남 서 NaN NaN \n",
|
|
"\n",
|
|
" node_id \n",
|
|
"8 u00 \n",
|
|
"9 u00 \n",
|
|
"10 u00 \n",
|
|
"11 u00 \n",
|
|
"12 u00 \n",
|
|
"13 u00 \n",
|
|
"14 u00 \n",
|
|
"15 u00 \n",
|
|
"26 u20 \n",
|
|
"27 u20 \n",
|
|
"28 u20 \n",
|
|
"29 u20 \n",
|
|
"30 c30 \n",
|
|
"31 c30 \n",
|
|
"32 c30 \n",
|
|
"33 c30 \n",
|
|
"34 c30 \n",
|
|
"35 c30 \n",
|
|
"36 c30 \n",
|
|
"37 c30 \n",
|
|
"46 u30 \n",
|
|
"47 u30 \n",
|
|
"48 u30 \n",
|
|
"49 u30 \n",
|
|
"50 u30 \n",
|
|
"51 u30 \n",
|
|
"52 u30 \n",
|
|
"53 u30 \n",
|
|
"54 u31 \n",
|
|
"55 u31 \n",
|
|
"56 u31 \n",
|
|
"57 u31 \n",
|
|
"58 u31 \n",
|
|
"59 u31 \n",
|
|
"60 u31 \n",
|
|
"61 u31 \n",
|
|
"62 u32 \n",
|
|
"63 u32 \n",
|
|
"64 u32 \n",
|
|
"65 u32 \n",
|
|
"66 u32 \n",
|
|
"67 u32 \n",
|
|
"68 u32 \n",
|
|
"69 u32 \n",
|
|
"100 u60 \n",
|
|
"101 u60 \n",
|
|
"102 u60 \n",
|
|
"103 u60 \n",
|
|
"104 u60 \n",
|
|
"105 u60 \n",
|
|
"106 u60 \n",
|
|
"107 u60 "
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>12</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>571500487_02</td>\n",
|
|
" <td>571500487_01.32</td>\n",
|
|
" <td>u00</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>21</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>17</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542810_01.51</td>\n",
|
|
" <td>571542810_02</td>\n",
|
|
" <td>u20</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>22</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_01</td>\n",
|
|
" <td>-571542116_02.96</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>23</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_02.96</td>\n",
|
|
" <td>571542116_02.164</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>24</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_01</td>\n",
|
|
" <td>-571542116_02.96</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>25</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_02.96</td>\n",
|
|
" <td>571542116_02.164</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>26</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_01</td>\n",
|
|
" <td>-571542116_02.96</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>27</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>20</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542116_02.96</td>\n",
|
|
" <td>571542116_02.164</td>\n",
|
|
" <td>c30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>40</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>571556452_01</td>\n",
|
|
" <td>571556452_02</td>\n",
|
|
" <td>u30</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>41</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571500475_02</td>\n",
|
|
" <td>571500475_01.26</td>\n",
|
|
" <td>u31</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>42</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>571540303_02</td>\n",
|
|
" <td>-571540303_02</td>\n",
|
|
" <td>u32</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>71</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>571500535_02</td>\n",
|
|
" <td>-571500535_02</td>\n",
|
|
" <td>u60</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id \\\n",
|
|
"12 175 7 북 동 571500487_02 571500487_01.32 \n",
|
|
"21 177 17 NaN NaN 571542810_01.51 571542810_02 \n",
|
|
"22 178 20 NaN NaN 571542116_01 -571542116_02.96 \n",
|
|
"23 178 20 NaN NaN 571542116_02.96 571542116_02.164 \n",
|
|
"24 178 20 NaN NaN 571542116_01 -571542116_02.96 \n",
|
|
"25 178 20 NaN NaN 571542116_02.96 571542116_02.164 \n",
|
|
"26 178 20 NaN NaN 571542116_01 -571542116_02.96 \n",
|
|
"27 178 20 NaN NaN 571542116_02.96 571542116_02.164 \n",
|
|
"40 178 6 동 서 571556452_01 571556452_02 \n",
|
|
"41 178 8 남 북 571500475_02 571500475_01.26 \n",
|
|
"42 178 4 북 남 571540303_02 -571540303_02 \n",
|
|
"71 210 5 서 북 571500535_02 -571500535_02 \n",
|
|
"\n",
|
|
" node_id \n",
|
|
"12 u00 \n",
|
|
"21 u20 \n",
|
|
"22 c30 \n",
|
|
"23 c30 \n",
|
|
"24 c30 \n",
|
|
"25 c30 \n",
|
|
"26 c30 \n",
|
|
"27 c30 \n",
|
|
"40 u30 \n",
|
|
"41 u31 \n",
|
|
"42 u32 \n",
|
|
"71 u60 "
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"match7 = self.match6.copy()\n",
|
|
"self.match7 = self.match7[['inter_no', 'move_no', 'inc_dire', 'out_dire', 'inc_edge_id', 'out_edge_id', 'node_id']]\n",
|
|
"display(self.match7[self.match7.node_id.isin(self.child_ids)])\n",
|
|
"display(self.matching[self.matching.node_id.isin(self.child_ids)])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>21</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>17</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542810_01.51</td>\n",
|
|
" <td>571542810_02</td>\n",
|
|
" <td>u20</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id node_id\n",
|
|
"21 177 17 NaN NaN 571542810_01.51 571542810_02 u20"
|
|
]
|
|
},
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.matching[self.matching.node_id=='u20']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 123,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"2. 중간산출물을 생성합니다.\n",
|
|
"2-1. 매칭 테이블들을 생성했습니다.\n",
|
|
"2-2. 비보호우회전(g)을 배정했습니다.\n",
|
|
"2-3. 직진 및 좌회전(G)을 배정했습니다.\n",
|
|
"2-2. node2num_cycles.json를 저장했습니다.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"self.get_intermediates()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>21</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>17</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>571542810_01.51</td>\n",
|
|
" <td>571542810_02</td>\n",
|
|
" <td>u20</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no move_no inc_dire out_dire inc_edge_id out_edge_id node_id\n",
|
|
"21 177 17 NaN NaN 571542810_01.51 571542810_02 u20"
|
|
]
|
|
},
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.matching[self.matching.node_id=='u20']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 16,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"ggggggggg\n",
|
|
"i0\n",
|
|
"571545870_02\n",
|
|
"571542797_02\n",
|
|
"inter_no 175\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571545870_02\n",
|
|
"out_edge_id 571542797_02\n",
|
|
"node_id i0\n",
|
|
"Name: 0, dtype: object\n",
|
|
"i0\n",
|
|
"571510153_02\n",
|
|
"571545870_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571510153_02\n",
|
|
"out_edge_id 571545870_01\n",
|
|
"node_id i0\n",
|
|
"Name: 1, dtype: object\n",
|
|
"i0\n",
|
|
"-571542797_02\n",
|
|
"571510153_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571542797_02\n",
|
|
"out_edge_id 571510153_01\n",
|
|
"node_id i0\n",
|
|
"Name: 2, dtype: object\n",
|
|
"i0\n",
|
|
"-571500487_01\n",
|
|
"571542797_02\n",
|
|
"inter_no 175\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id -571500487_01\n",
|
|
"out_edge_id 571542797_02\n",
|
|
"node_id i0\n",
|
|
"Name: 3, dtype: object\n",
|
|
"i0\n",
|
|
"-571500487_01\n",
|
|
"571542797_02\n",
|
|
"inter_no 175\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id -571500487_01\n",
|
|
"out_edge_id 571542797_02\n",
|
|
"node_id i0\n",
|
|
"Name: 3, dtype: object\n",
|
|
"i0\n",
|
|
"571510153_02\n",
|
|
"571500487_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571510153_02\n",
|
|
"out_edge_id 571500487_01\n",
|
|
"node_id i0\n",
|
|
"Name: 4, dtype: object\n",
|
|
"i0\n",
|
|
"571545870_02\n",
|
|
"571510153_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571545870_02\n",
|
|
"out_edge_id 571510153_01\n",
|
|
"node_id i0\n",
|
|
"Name: 5, dtype: object\n",
|
|
"i0\n",
|
|
"571545870_02\n",
|
|
"571510153_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571545870_02\n",
|
|
"out_edge_id 571510153_01\n",
|
|
"node_id i0\n",
|
|
"Name: 5, dtype: object\n",
|
|
"i0\n",
|
|
"-571500487_01\n",
|
|
"571545870_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id -571500487_01\n",
|
|
"out_edge_id 571545870_01\n",
|
|
"node_id i0\n",
|
|
"Name: 6, dtype: object\n",
|
|
"i0\n",
|
|
"-571542797_02\n",
|
|
"571500487_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542797_02\n",
|
|
"out_edge_id 571500487_01\n",
|
|
"node_id i0\n",
|
|
"Name: 7, dtype: object\n",
|
|
"i0\n",
|
|
"-571542797_02\n",
|
|
"571500487_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542797_02\n",
|
|
"out_edge_id 571500487_01\n",
|
|
"node_id i0\n",
|
|
"Name: 7, dtype: object\n",
|
|
"i0\n",
|
|
"-571542797_02\n",
|
|
"571500487_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542797_02\n",
|
|
"out_edge_id 571500487_01\n",
|
|
"node_id i0\n",
|
|
"Name: 7, dtype: object\n",
|
|
"i0\n",
|
|
"-571542797_02\n",
|
|
"571500487_01\n",
|
|
"inter_no 175\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542797_02\n",
|
|
"out_edge_id 571500487_01\n",
|
|
"node_id i0\n",
|
|
"Name: 7, dtype: object\n",
|
|
"u00\n",
|
|
"571500487_02\n",
|
|
"571500487_01.32\n",
|
|
"inter_no 175\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571500487_02\n",
|
|
"out_edge_id 571500487_01.32\n",
|
|
"node_id u00\n",
|
|
"Name: 12, dtype: object\n",
|
|
"i1\n",
|
|
"-571542810_01\n",
|
|
"571543469_01\n",
|
|
"inter_no 176\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571542810_01\n",
|
|
"out_edge_id 571543469_01\n",
|
|
"node_id i1\n",
|
|
"Name: 13, dtype: object\n",
|
|
"i1\n",
|
|
"571542797_02.99\n",
|
|
"571542810_01\n",
|
|
"inter_no 176\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571542797_02.99\n",
|
|
"out_edge_id 571542810_01\n",
|
|
"node_id i1\n",
|
|
"Name: 14, dtype: object\n",
|
|
"i1\n",
|
|
"571542797_02.99\n",
|
|
"571542810_01\n",
|
|
"inter_no 176\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571542797_02.99\n",
|
|
"out_edge_id 571542810_01\n",
|
|
"node_id i1\n",
|
|
"Name: 14, dtype: object\n",
|
|
"i1\n",
|
|
"571543469_02\n",
|
|
"-571542797_02.99\n",
|
|
"inter_no 176\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571543469_02\n",
|
|
"out_edge_id -571542797_02.99\n",
|
|
"node_id i1\n",
|
|
"Name: 15, dtype: object\n",
|
|
"i1\n",
|
|
"571543469_02\n",
|
|
"-571542797_02.99\n",
|
|
"inter_no 176\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571543469_02\n",
|
|
"out_edge_id -571542797_02.99\n",
|
|
"node_id i1\n",
|
|
"Name: 15, dtype: object\n",
|
|
"i1\n",
|
|
"-571542810_01\n",
|
|
"-571542797_02.99\n",
|
|
"inter_no 176\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542810_01\n",
|
|
"out_edge_id -571542797_02.99\n",
|
|
"node_id i1\n",
|
|
"Name: 16, dtype: object\n",
|
|
"i1\n",
|
|
"-571542810_01\n",
|
|
"-571542797_02.99\n",
|
|
"inter_no 176\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542810_01\n",
|
|
"out_edge_id -571542797_02.99\n",
|
|
"node_id i1\n",
|
|
"Name: 16, dtype: object\n",
|
|
"i1\n",
|
|
"-571542810_01\n",
|
|
"-571542797_02.99\n",
|
|
"inter_no 176\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542810_01\n",
|
|
"out_edge_id -571542797_02.99\n",
|
|
"node_id i1\n",
|
|
"Name: 16, dtype: object\n",
|
|
"i2\n",
|
|
"571542811_02\n",
|
|
"571542809_01\n",
|
|
"inter_no 177\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571542811_02\n",
|
|
"out_edge_id 571542809_01\n",
|
|
"node_id i2\n",
|
|
"Name: 19, dtype: object\n",
|
|
"i2\n",
|
|
"571542811_02\n",
|
|
"571542809_01\n",
|
|
"inter_no 177\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571542811_02\n",
|
|
"out_edge_id 571542809_01\n",
|
|
"node_id i2\n",
|
|
"Name: 19, dtype: object\n",
|
|
"i2\n",
|
|
"-571542809_01\n",
|
|
"571542811_01\n",
|
|
"inter_no 177\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542809_01\n",
|
|
"out_edge_id 571542811_01\n",
|
|
"node_id i2\n",
|
|
"Name: 20, dtype: object\n",
|
|
"i2\n",
|
|
"-571542809_01\n",
|
|
"571542811_01\n",
|
|
"inter_no 177\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542809_01\n",
|
|
"out_edge_id 571542811_01\n",
|
|
"node_id i2\n",
|
|
"Name: 20, dtype: object\n",
|
|
"i2\n",
|
|
"-571542809_01\n",
|
|
"571542811_01\n",
|
|
"inter_no 177\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571542809_01\n",
|
|
"out_edge_id 571542811_01\n",
|
|
"node_id i2\n",
|
|
"Name: 20, dtype: object\n",
|
|
"i3\n",
|
|
"-571500475_01\n",
|
|
"571540304_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id -571500475_01\n",
|
|
"out_edge_id 571540304_01\n",
|
|
"node_id i3\n",
|
|
"Name: 21, dtype: object\n",
|
|
"i3\n",
|
|
"571540303_02.21\n",
|
|
"571500475_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571540303_02.21\n",
|
|
"out_edge_id 571500475_01\n",
|
|
"node_id i3\n",
|
|
"Name: 22, dtype: object\n",
|
|
"i3\n",
|
|
"571540303_02.21\n",
|
|
"571500475_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571540303_02.21\n",
|
|
"out_edge_id 571500475_01\n",
|
|
"node_id i3\n",
|
|
"Name: 22, dtype: object\n",
|
|
"i3\n",
|
|
"571540303_02.21\n",
|
|
"571500475_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571540303_02.21\n",
|
|
"out_edge_id 571500475_01\n",
|
|
"node_id i3\n",
|
|
"Name: 22, dtype: object\n",
|
|
"i3\n",
|
|
"571540304_02\n",
|
|
"571540303_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571540304_02\n",
|
|
"out_edge_id 571540303_01\n",
|
|
"node_id i3\n",
|
|
"Name: 23, dtype: object\n",
|
|
"i3\n",
|
|
"571556450_02\n",
|
|
"571540304_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571556450_02\n",
|
|
"out_edge_id 571540304_01\n",
|
|
"node_id i3\n",
|
|
"Name: 24, dtype: object\n",
|
|
"i3\n",
|
|
"571556450_02\n",
|
|
"571540304_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571556450_02\n",
|
|
"out_edge_id 571540304_01\n",
|
|
"node_id i3\n",
|
|
"Name: 24, dtype: object\n",
|
|
"i3\n",
|
|
"571556450_02\n",
|
|
"571540304_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571556450_02\n",
|
|
"out_edge_id 571540304_01\n",
|
|
"node_id i3\n",
|
|
"Name: 24, dtype: object\n",
|
|
"i3\n",
|
|
"571540303_02.21\n",
|
|
"571556450_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571540303_02.21\n",
|
|
"out_edge_id 571556450_01\n",
|
|
"node_id i3\n",
|
|
"Name: 25, dtype: object\n",
|
|
"i3\n",
|
|
"-571500475_01\n",
|
|
"571540303_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571500475_01\n",
|
|
"out_edge_id 571540303_01\n",
|
|
"node_id i3\n",
|
|
"Name: 26, dtype: object\n",
|
|
"i3\n",
|
|
"-571500475_01\n",
|
|
"571540303_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571500475_01\n",
|
|
"out_edge_id 571540303_01\n",
|
|
"node_id i3\n",
|
|
"Name: 26, dtype: object\n",
|
|
"i3\n",
|
|
"-571500475_01\n",
|
|
"571540303_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571500475_01\n",
|
|
"out_edge_id 571540303_01\n",
|
|
"node_id i3\n",
|
|
"Name: 26, dtype: object\n",
|
|
"i3\n",
|
|
"571556450_02\n",
|
|
"571500475_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571556450_02\n",
|
|
"out_edge_id 571500475_01\n",
|
|
"node_id i3\n",
|
|
"Name: 27, dtype: object\n",
|
|
"i3\n",
|
|
"571540304_02\n",
|
|
"571556450_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571540304_02\n",
|
|
"out_edge_id 571556450_01\n",
|
|
"node_id i3\n",
|
|
"Name: 28, dtype: object\n",
|
|
"i3\n",
|
|
"571540304_02\n",
|
|
"571556450_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571540304_02\n",
|
|
"out_edge_id 571556450_01\n",
|
|
"node_id i3\n",
|
|
"Name: 28, dtype: object\n",
|
|
"i3\n",
|
|
"571540304_02\n",
|
|
"571556450_01\n",
|
|
"inter_no 178\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571540304_02\n",
|
|
"out_edge_id 571556450_01\n",
|
|
"node_id i3\n",
|
|
"Name: 28, dtype: object\n",
|
|
"u30\n",
|
|
"571556452_01\n",
|
|
"571556452_02\n",
|
|
"inter_no 178\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571556452_01\n",
|
|
"out_edge_id 571556452_02\n",
|
|
"node_id u30\n",
|
|
"Name: 33, dtype: object\n",
|
|
"u31\n",
|
|
"571500475_02\n",
|
|
"571500475_01.26\n",
|
|
"inter_no 178\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571500475_02\n",
|
|
"out_edge_id 571500475_01.26\n",
|
|
"node_id u31\n",
|
|
"Name: 34, dtype: object\n",
|
|
"u32\n",
|
|
"571540303_02\n",
|
|
"-571540303_02\n",
|
|
"inter_no 178\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571540303_02\n",
|
|
"out_edge_id -571540303_02\n",
|
|
"node_id u32\n",
|
|
"Name: 35, dtype: object\n",
|
|
"i8\n",
|
|
"571500617_02\n",
|
|
"571500569_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571500617_02\n",
|
|
"out_edge_id 571500569_01\n",
|
|
"node_id i8\n",
|
|
"Name: 36, dtype: object\n",
|
|
"i8\n",
|
|
"571500618_02\n",
|
|
"571500617_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571500618_02\n",
|
|
"out_edge_id 571500617_01\n",
|
|
"node_id i8\n",
|
|
"Name: 37, dtype: object\n",
|
|
"i8\n",
|
|
"571500618_02\n",
|
|
"571500617_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571500618_02\n",
|
|
"out_edge_id 571500617_01\n",
|
|
"node_id i8\n",
|
|
"Name: 37, dtype: object\n",
|
|
"i8\n",
|
|
"-571500569_01\n",
|
|
"571500618_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571500569_01\n",
|
|
"out_edge_id 571500618_01\n",
|
|
"node_id i8\n",
|
|
"Name: 38, dtype: object\n",
|
|
"i8\n",
|
|
"571500583_01\n",
|
|
"571500569_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571500583_01\n",
|
|
"out_edge_id 571500569_01\n",
|
|
"node_id i8\n",
|
|
"Name: 39, dtype: object\n",
|
|
"i8\n",
|
|
"571500583_01\n",
|
|
"571500569_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571500583_01\n",
|
|
"out_edge_id 571500569_01\n",
|
|
"node_id i8\n",
|
|
"Name: 39, dtype: object\n",
|
|
"i8\n",
|
|
"571500618_02\n",
|
|
"571500583_02\n",
|
|
"inter_no 201\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571500618_02\n",
|
|
"out_edge_id 571500583_02\n",
|
|
"node_id i8\n",
|
|
"Name: 40, dtype: object\n",
|
|
"i8\n",
|
|
"571500617_02\n",
|
|
"571500618_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571500617_02\n",
|
|
"out_edge_id 571500618_01\n",
|
|
"node_id i8\n",
|
|
"Name: 41, dtype: object\n",
|
|
"i8\n",
|
|
"571500617_02\n",
|
|
"571500618_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571500617_02\n",
|
|
"out_edge_id 571500618_01\n",
|
|
"node_id i8\n",
|
|
"Name: 41, dtype: object\n",
|
|
"i8\n",
|
|
"571500617_02\n",
|
|
"571500618_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571500617_02\n",
|
|
"out_edge_id 571500618_01\n",
|
|
"node_id i8\n",
|
|
"Name: 41, dtype: object\n",
|
|
"i8\n",
|
|
"571500583_01\n",
|
|
"571500617_01\n",
|
|
"inter_no 201\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571500583_01\n",
|
|
"out_edge_id 571500617_01\n",
|
|
"node_id i8\n",
|
|
"Name: 42, dtype: object\n",
|
|
"i8\n",
|
|
"-571500569_01\n",
|
|
"571500583_02\n",
|
|
"inter_no 201\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571500569_01\n",
|
|
"out_edge_id 571500583_02\n",
|
|
"node_id i8\n",
|
|
"Name: 43, dtype: object\n",
|
|
"i8\n",
|
|
"-571500569_01\n",
|
|
"571500583_02\n",
|
|
"inter_no 201\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571500569_01\n",
|
|
"out_edge_id 571500583_02\n",
|
|
"node_id i8\n",
|
|
"Name: 43, dtype: object\n",
|
|
"i9\n",
|
|
"571510152_01\n",
|
|
"571510152_01.65\n",
|
|
"inter_no 202\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571510152_01\n",
|
|
"out_edge_id 571510152_01.65\n",
|
|
"node_id i9\n",
|
|
"Name: 48, dtype: object\n",
|
|
"i9\n",
|
|
"571510152_01\n",
|
|
"571510152_01.65\n",
|
|
"inter_no 202\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571510152_01\n",
|
|
"out_edge_id 571510152_01.65\n",
|
|
"node_id i9\n",
|
|
"Name: 48, dtype: object\n",
|
|
"i9\n",
|
|
"571510152_02\n",
|
|
"-571510152_01\n",
|
|
"inter_no 202\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571510152_02\n",
|
|
"out_edge_id -571510152_01\n",
|
|
"node_id i9\n",
|
|
"Name: 49, dtype: object\n",
|
|
"i9\n",
|
|
"571510152_02\n",
|
|
"-571510152_01\n",
|
|
"inter_no 202\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id 571510152_02\n",
|
|
"out_edge_id -571510152_01\n",
|
|
"node_id i9\n",
|
|
"Name: 49, dtype: object\n",
|
|
"i7\n",
|
|
"571542073_01\n",
|
|
"571511538_02\n",
|
|
"inter_no 206\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571542073_01\n",
|
|
"out_edge_id 571511538_02\n",
|
|
"node_id i7\n",
|
|
"Name: 50, dtype: object\n",
|
|
"i7\n",
|
|
"571542073_01\n",
|
|
"571511538_02\n",
|
|
"inter_no 206\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571542073_01\n",
|
|
"out_edge_id 571511538_02\n",
|
|
"node_id i7\n",
|
|
"Name: 50, dtype: object\n",
|
|
"i7\n",
|
|
"-571511538_02\n",
|
|
"571542073_02\n",
|
|
"inter_no 206\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571511538_02\n",
|
|
"out_edge_id 571542073_02\n",
|
|
"node_id i7\n",
|
|
"Name: 51, dtype: object\n",
|
|
"i7\n",
|
|
"-571511538_02\n",
|
|
"571542073_02\n",
|
|
"inter_no 206\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id -571511538_02\n",
|
|
"out_edge_id 571542073_02\n",
|
|
"node_id i7\n",
|
|
"Name: 51, dtype: object\n",
|
|
"i6\n",
|
|
"-571542115_01\n",
|
|
"571500585_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id -571542115_01\n",
|
|
"out_edge_id 571500585_01\n",
|
|
"node_id i6\n",
|
|
"Name: 52, dtype: object\n",
|
|
"i6\n",
|
|
"571500535_02.18\n",
|
|
"571542115_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571500535_02.18\n",
|
|
"out_edge_id 571542115_01\n",
|
|
"node_id i6\n",
|
|
"Name: 53, dtype: object\n",
|
|
"i6\n",
|
|
"571500535_02.18\n",
|
|
"571542115_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571500535_02.18\n",
|
|
"out_edge_id 571542115_01\n",
|
|
"node_id i6\n",
|
|
"Name: 53, dtype: object\n",
|
|
"i6\n",
|
|
"571511538_02.121\n",
|
|
"571500585_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571511538_02.121\n",
|
|
"out_edge_id 571500585_01\n",
|
|
"node_id i6\n",
|
|
"Name: 55, dtype: object\n",
|
|
"i6\n",
|
|
"571511538_02.121\n",
|
|
"571500585_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"inc_edge_id 571511538_02.121\n",
|
|
"out_edge_id 571500585_01\n",
|
|
"node_id i6\n",
|
|
"Name: 55, dtype: object\n",
|
|
"i6\n",
|
|
"571500535_02.18\n",
|
|
"571511538_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571500535_02.18\n",
|
|
"out_edge_id 571511538_01\n",
|
|
"node_id i6\n",
|
|
"Name: 56, dtype: object\n",
|
|
"i6\n",
|
|
"-571542115_01\n",
|
|
"571500535_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571542115_01\n",
|
|
"out_edge_id 571500535_01\n",
|
|
"node_id i6\n",
|
|
"Name: 57, dtype: object\n",
|
|
"i6\n",
|
|
"-571542115_01\n",
|
|
"571500535_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571542115_01\n",
|
|
"out_edge_id 571500535_01\n",
|
|
"node_id i6\n",
|
|
"Name: 57, dtype: object\n",
|
|
"i6\n",
|
|
"-571542115_01\n",
|
|
"571500535_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"inc_edge_id -571542115_01\n",
|
|
"out_edge_id 571500535_01\n",
|
|
"node_id i6\n",
|
|
"Name: 57, dtype: object\n",
|
|
"i6\n",
|
|
"571511538_02.121\n",
|
|
"571542115_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"inc_edge_id 571511538_02.121\n",
|
|
"out_edge_id 571542115_01\n",
|
|
"node_id i6\n",
|
|
"Name: 58, dtype: object\n",
|
|
"i6\n",
|
|
"571500585_02\n",
|
|
"571511538_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571500585_02\n",
|
|
"out_edge_id 571511538_01\n",
|
|
"node_id i6\n",
|
|
"Name: 59, dtype: object\n",
|
|
"i6\n",
|
|
"571500585_02\n",
|
|
"571511538_01\n",
|
|
"inter_no 210\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571500585_02\n",
|
|
"out_edge_id 571511538_01\n",
|
|
"node_id i6\n",
|
|
"Name: 59, dtype: object\n",
|
|
"u60\n",
|
|
"571500535_02\n",
|
|
"-571500535_02\n",
|
|
"inter_no 210\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"inc_edge_id 571500535_02\n",
|
|
"out_edge_id -571500535_02\n",
|
|
"node_id u60\n",
|
|
"Name: 64, dtype: object\n",
|
|
"ggggrgggg\n",
|
|
"ggggrgggg\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"NODE_ID = 'u00'\n",
|
|
"self.nodes = [self.net.getNode(node_id) for node_id in self.node_ids]\n",
|
|
"self.node2init = {}\n",
|
|
"# 모든 노드들을 순회\n",
|
|
"for node in self.nodes:\n",
|
|
" node_id = node.getID()\n",
|
|
" # 모든 connection\n",
|
|
" conns = [(c.getJunctionIndex(), c) for c in node.getConnections()]\n",
|
|
" conns = [c for c in conns if c[0] >= 0]\n",
|
|
" conns = sorted(conns, key=lambda x: x[0])\n",
|
|
" state = []\n",
|
|
" # i번째 connection : ci\n",
|
|
" for i, ci in conns:\n",
|
|
" if ci.getTLLinkIndex() < 0:\n",
|
|
" continue\n",
|
|
" are_foes = False\n",
|
|
" # j번째 connection : cj\n",
|
|
" # 합류지점이 다르면서 상충되는 cj가 존재하면 are_foes = True (r)\n",
|
|
" # 그외의 경우에는 are_foes = False (g)\n",
|
|
" for j, cj in conns:\n",
|
|
" # ci, cj의 합류지점이 같으면 통과\n",
|
|
" if ci.getTo() == cj.getTo():\n",
|
|
" continue\n",
|
|
" # ci, cj가 상충되면 are_foes를 True로 지정.\n",
|
|
" if node.areFoes(i, j):\n",
|
|
" are_foes = True\n",
|
|
" break\n",
|
|
" state.append('r' if are_foes else 'g')\n",
|
|
" self.node2init[node_id] = state\n",
|
|
"print(''.join(self.node2init[NODE_ID]))\n",
|
|
"\n",
|
|
"# 어떤 연결과도 상충이 일어나지는 않지만, 신호가 부여되어 있는 경우에는 r을 부여\n",
|
|
"for _, row in self.matching.iterrows():\n",
|
|
" node_id = row.node_id\n",
|
|
" move_no = row.move_no\n",
|
|
" inc_edge_id = row.inc_edge_id\n",
|
|
" out_edge_id = row.out_edge_id\n",
|
|
" if move_no != 21:\n",
|
|
" inc_edge = self.net.getEdge(inc_edge_id)\n",
|
|
" out_edge = self.net.getEdge(out_edge_id)\n",
|
|
" for conn in inc_edge.getConnections(out_edge):\n",
|
|
" index = conn.getTLLinkIndex()\n",
|
|
" if index >= 0:\n",
|
|
" print(node_id)\n",
|
|
" print(inc_edge_id)\n",
|
|
" print(out_edge_id)\n",
|
|
" print(row)\n",
|
|
" self.node2init[node_id][index] = 'r'\n",
|
|
"print(''.join(self.node2init[NODE_ID]))\n",
|
|
"\n",
|
|
"# 유턴교차로\n",
|
|
"for _, row in self.u_turn.iterrows():\n",
|
|
" node_id = row.child_id\n",
|
|
" inc_edge_id = row.inc_edge_id\n",
|
|
" out_edge = row.out_edge_id\n",
|
|
" if not (pd.isna(inc_edge_id) and pd.isna(out_edge_id)):\n",
|
|
" inc_edge = self.net.getEdge(inc_edge_id)\n",
|
|
" out_edge = self.net.getEdge(out_edge_id)\n",
|
|
" for conn in inc_edge.getConnections(out_edge):\n",
|
|
" index = conn.getTLLinkIndex()\n",
|
|
" if index >= 0:\n",
|
|
" self.node2init[node_id][index] = 'r'\n",
|
|
"print(''.join(self.node2init[NODE_ID]))\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 22,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"2-2. 비보호우회전(g)을 배정했습니다.\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"['g', 'g', 'g', 'g', 'g', 'g']"
|
|
]
|
|
},
|
|
"execution_count": 22,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.initialize_state()\n",
|
|
"\n",
|
|
"self.node2init['u20']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 131,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"['r', 'r', 'g', 'g', 'r', 'r', 'r']"
|
|
]
|
|
},
|
|
"execution_count": 131,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.node2init['i2']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 132,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" <th>phase_no</th>\n",
|
|
" <th>ring_type</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>state</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrgrrrgGGGGrgrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>gGGrgrrrgrrrrrgrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>grrGgrrrgrrrrrgrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>grrrgrrrgrrrrGgrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>grrrgGGrgrrrrrgrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>grrrgrrGgrrrrrgrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrgrrrgrrrrrgrG</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>grrrgrrrgrrrrrgGr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>8</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>ggggrgggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>9</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>ggggrgggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>10</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>571500487_02</td>\n",
|
|
" <td>571500487_01.32</td>\n",
|
|
" <td>ggggGgggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>11</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>ggggrgggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>12</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>ggggrgggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>13</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>ggggrgggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>14</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>ggggrgggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>15</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>u00</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>ggggrgggg</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no node_id phase_no ring_type move_no inc_edge_id \\\n",
|
|
"0 175 i0 1 A 8 -571542797_02 \n",
|
|
"1 175 i0 1 B 4 -571500487_01 \n",
|
|
"2 175 i0 2 A 7 -571500487_01 \n",
|
|
"3 175 i0 2 B 3 -571542797_02 \n",
|
|
"4 175 i0 3 A 6 571545870_02 \n",
|
|
"5 175 i0 3 B 1 571545870_02 \n",
|
|
"6 175 i0 4 A 5 571510153_02 \n",
|
|
"7 175 i0 4 B 2 571510153_02 \n",
|
|
"8 175 u00 1 A 8 NaN \n",
|
|
"9 175 u00 1 B 4 NaN \n",
|
|
"10 175 u00 2 A 7 571500487_02 \n",
|
|
"11 175 u00 2 B 3 NaN \n",
|
|
"12 175 u00 3 A 6 NaN \n",
|
|
"13 175 u00 3 B 1 NaN \n",
|
|
"14 175 u00 4 A 5 NaN \n",
|
|
"15 175 u00 4 B 2 NaN \n",
|
|
"\n",
|
|
" out_edge_id state \n",
|
|
"0 571500487_01 grrrgrrrgGGGGrgrr \n",
|
|
"1 571542797_02 gGGrgrrrgrrrrrgrr \n",
|
|
"2 571545870_01 grrGgrrrgrrrrrgrr \n",
|
|
"3 571510153_01 grrrgrrrgrrrrGgrr \n",
|
|
"4 571510153_01 grrrgGGrgrrrrrgrr \n",
|
|
"5 571542797_02 grrrgrrGgrrrrrgrr \n",
|
|
"6 571500487_01 grrrgrrrgrrrrrgrG \n",
|
|
"7 571545870_01 grrrgrrrgrrrrrgGr \n",
|
|
"8 NaN ggggrgggg \n",
|
|
"9 NaN ggggrgggg \n",
|
|
"10 571500487_01.32 ggggGgggg \n",
|
|
"11 NaN ggggrgggg \n",
|
|
"12 NaN ggggrgggg \n",
|
|
"13 NaN ggggrgggg \n",
|
|
"14 NaN ggggrgggg \n",
|
|
"15 NaN ggggrgggg "
|
|
]
|
|
},
|
|
"execution_count": 132,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.match6[self.match6.node_id.isin(['i0', 'u00'])]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 127,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" <th>phase_no</th>\n",
|
|
" <th>ring_type</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>state</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>22</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>i2</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>-571542809_01</td>\n",
|
|
" <td>571542811_01</td>\n",
|
|
" <td>rrggGGG</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>23</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>i2</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>571542811_02</td>\n",
|
|
" <td>571542809_01</td>\n",
|
|
" <td>GGggrrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>24</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>i2</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>17</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>rrggrrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>25</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>i2</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>18</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>rrggrrr</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>26</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>gggggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>27</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>gggggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>28</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>17</td>\n",
|
|
" <td>571542810_01.51</td>\n",
|
|
" <td>571542810_02</td>\n",
|
|
" <td>ggGggg</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>29</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>u20</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>18</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>gggggg</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no node_id phase_no ring_type move_no inc_edge_id \\\n",
|
|
"22 177 i2 1 A 8 -571542809_01 \n",
|
|
"23 177 i2 1 B 4 571542811_02 \n",
|
|
"24 177 i2 2 A 17 NaN \n",
|
|
"25 177 i2 2 B 18 NaN \n",
|
|
"26 177 u20 1 A 8 NaN \n",
|
|
"27 177 u20 1 B 4 NaN \n",
|
|
"28 177 u20 2 A 17 571542810_01.51 \n",
|
|
"29 177 u20 2 B 18 NaN \n",
|
|
"\n",
|
|
" out_edge_id state \n",
|
|
"22 571542811_01 rrggGGG \n",
|
|
"23 571542809_01 GGggrrr \n",
|
|
"24 NaN rrggrrr \n",
|
|
"25 NaN rrggrrr \n",
|
|
"26 NaN gggggg \n",
|
|
"27 NaN gggggg \n",
|
|
"28 571542810_02 ggGggg \n",
|
|
"29 NaN gggggg "
|
|
]
|
|
},
|
|
"execution_count": 127,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.match6[self.match6.node_id.isin(['i2', 'u20'])]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"'''Given `inter_no`, `inc_edge_id` and `out_edge_id`, we have `inc_vec = inter2inc2vec[inter_no][inc_edge_id]` and `out_vec = inter2out2vec[inter_no][out_edge_id]`.\n",
|
|
"Rotate `inc_vec` by 90, 180 and 270 degrees clockwise, to define \n",
|
|
"`out_vec_left`, `out_vec_straight` and `out_vec_right`.\n",
|
|
"Define `out_vecs={'right':out_vec_left, 'straight':out_vec_straight, 'right':out_vec_right}`.\n",
|
|
"Select the key that maximize the similarity of the corresponding value of the key and `inc_vec`.'''"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "sts",
|
|
"language": "python",
|
|
"name": "sts"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.10"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|