我正在使用以下代码将networkx图转换为python中的Numpy矩阵:
a = networkx.attr_matrix(G, edge_attr='length')
产生以下输出:
(matrix([[ 0. , 0. , 1.2, ..., 0. , 0. , 0. ],
[ 0. , 0. , 0. , ..., 0. , 0. , 0. ],
[ 1.2, 0. , 0. , ..., 0. , 0. , 0. ],
...,
[ 0. , 0. , 0. , ..., 0. , 0. , 0. ],
[ 0. , 0. , 0. , ..., 0. , 0. , 0. ],
[ 0. , 0. , 0. , ..., 0. , 0. , 0. ]]), [u'2103498021', u'2103498020', u'2103498023', u'113989403', u'113989405', u'1710872366', u'3685289122', u'3685289123', u'3685289120', u'3685289121', u'3685289126', u'3685289128', u'3685289124', u'3685289125', u'1270530876', u'3685289129', u'1270530979', u'113994337', u'1270530844', u'4263217243', u'3685282301', u'2937091496', u'2937091497', u'1270531058', u'2937091495', u'1270531057', u'2937091498', u'113989407', u'3918709551', u'2597724409', u'113989367', u'3685289157', u'3685289156', u'3685289155', u'3685289154', u'3685289153', u'3685289152', u'3685289151', u'3685289150', u'1629018759', u'113987788', u'2937103124', u'1629018754', u'1629018756', u'114069275', u'113987780', u'1629018753', u'113987782', u'3262155880', u'3262155881', u'3262155882', u'3262155883', u'3262155884', u'3262155885', u'3262155886', u'3262155887', u'3262155888', u'3262155889', u'1270530802', u'1270530803', u'1270530801', u'1270530807', u'1270530805', u'2528097856', u'3273710060', u'114040485', u'2528097850', u'114069750', u'1422819396', u'1270530903', u'2528097838', u'2528097836', u'2528097781', u'1270531300', u'2528097783', u'2528097833', u'1422819399', u'2961370878', u'3685289059', u'2961370880', u'3659523420', u'3685289115', u'113983514', u'113983517', u'113983510', u'3009662954', u'2533981174', u'2961370893', u'2528097738', u'2527930348', u'2528097734', u'2527930345', u'2528097736', u'2528097730', u'1270530896', u'3685289118', u'114031125', u'114031127', u'114031120', u'114031122', u'114049411', u'114049416', u'3685282307', u'114049419', u'113984703', u'1262307740', u'3139383928', u'2937091494', u'1629012440', u'3685289039', u'3139383922', u'3685282293', u'1629012448', u'2286194048', u'3685282309', u'2503917256', u'3685289048', u'1629020232', u'3685282297', u'3639960419', u'3685289062', u'3685289040', u'3685289043', u'1270530940', u'3685289045', u'3685289044', u'3685289046', u'114031158', u'3685282298', u'114084234', u'114048644', u'114031153', u'114031155', u'114048640', u'114031156', u'2528097742', u'3685289064', u'1629012432', u'1629012433', u'2284957788', u'1629012436', u'1629012437', u'114028689', u'1629012435', u'114028686', u'114056028', u'114028684', u'1629012380', u'2284957787', u'1270531134', u'1270531132', u'113980227', u'2937091499', u'2922483978', u'2922483979', u'113980221', u'2922483974', u'2922483975', u'2922483976', u'2922483977', u'3090013646', u'2922483971', u'2528097806', u'2922483973', u'1270530920', u'1270530923', u'1270530926', u'1270530929', u'113989369', u'3659523418', u'3659523419', u'1270531003', u'1270531004', u'3009662959', u'2528097744', u'2528097746', u'1270531342', u'1270531343', u'3735056067', u'3735056066', u'3735056069', u'3735056068', u'2528097748', u'1270531348', u'3685282304', u'114029692', u'114029697', u'114040582', u'2937103126', u'114040581', u'2533981132', u'3139384139', u'1629015474', u'1270259002', u'113926538', u'113987784', u'1270531505', u'1270531502', u'1883124183', u'2937103129', u'2528097827', u'113981738', u'2528097909', u'113981735', u'113981732', u'2528097901', u'114054795', u'2528097865', u'114054793', u'2961370859', u'114054791', u'2528097869', u'2985311327', u'2985311324', u'2985311325', u'2985311322', u'2985311323', u'2961370851', u'1282008643', u'4247439666', u'2961370913', u'113987769', u'114071602', u'113987767', u'113994578', u'113987763', u'660554755', u'1270530749', u'113983524', u'113983527', u'2533981147', u'113983522', u'1270530740', u'1270530743', u'1629012404', u'1270530745', u'1270530747', u'114003632', u'114003635', u'114024422', u'114003637', u'113926512', u'2966038222', u'2966038223', u'2966038220', u'2966038221', u'2966038224', u'114024428', u'114031114', u'660554760', u'114024435', u'114031118', u'2937092620', u'2937092621', u'2937092622', u'2937092623', u'2937092624', u'2937092625', u'3685289098', u'3685289099', u'3685289096', u'2937092629', u'3685289094', u'657999922', u'3685289092', u'3685289093', u'3685289090', u'1629012471', u'1629015518', u'4071794959', u'114003640', u'114064326', u'3009655126', u'1629015515', u'4071794956', u'1629015517', u'3685289139', u'3685289138', u'2103498016', u'2103498017', u'1710872352', u'2103498013', u'3685289131', u'3685289130', u'3685289133', u'3685289132', u'2103498018', u'3685289134', u'3685289137', u'3685289136', u'2103276408', u'3639960420', u'1270530965', u'3685289089', u'2103276406', u'1270530961', u'1270530960', u'1270530963', u'1629012430', u'2528097898', u'1270531049', u'114069281', u'1270531045', u'1270531044', u'1270531047', u'2793972786', u'1270531040', u'1270531043', u'1270531042', u'3685289085', u'114049407', u'113989373', u'3685289058', u'2958019669', u'2922483981', u'2922483980', u'2922483982', u'2937103131', u'2937103130', u'114049402', u'114069263', u'114069261', u'3685289127', u'114069267', u'3685289114', u'2973854053', u'3262155897', u'3262155896', u'3262155895', u'3262155894', u'3262155893', u'2937092639', u'3262155891', u'3262155890', u'1270530795', u'2700773956', u'1270530793', u'3262155899', u'3262155898', u'2528105340', u'1270265888', u'1270530812', u'2528105344', u'1270530814', u'1270530819', u'1270531541', u'1270265884', u'2528097895', u'3273710054', u'3273710055', u'3273710056', u'3273710057', u'114040490', u'3273710053', u'3273710058', u'3273710059', u'1270531318', u'2528097829', u'2528097825', u'2961370892', u'1270531313', u'2528097821', u'2973853229', u'2528097823', u'1270531316', u'3685289119', u'2973854054', u'1422853701', u'1883124245', u'1282008804', u'114047824', u'114047821', u'114047822', u'113980215', u'2528097936', u'2985311329', u'113981747', u'2528097950', u'114049406', u'113981744', u'113981741', u'2528097956', u'2528097892', u'658404076', u'114049409', u'2937091500', u'1270531344', u'2961370864', u'2961370863', u'2961370861', u'3139383916', u'114063429', u'1629018785', u'3262155879', u'3262155878', u'114049404', u'114071605', u'3685289078', u'3685289079', u'1524810661', u'1524810660', u'3685289074', u'3685289075', u'2528097740', u'3685289077', u'3685289070', u'3685289071', u'3685289072', u'3685289073', u'2925067967', u'2528097831', u'1629012377', u'114091427', u'114091425', u'1422819345', u'113994575', u'2973854046', u'2973854047', u'1629012427', u'114028697', u'1629012429', u'1629012428', u'2973854048', u'1262307729', u'113987765', u'113986425', u'114077349', u'3685282317', u'1524810666', u'113980231', u'1270531331', u'2922483963', u'2922483962', u'2922483961', u'2922483960', u'2922483967', u'2922483966', u'2922483965', u'2922483964', u'2528097803', u'113981630', u'3357398452', u'2973854049', u'1270530917', u'2503917295', u'3685282321', u'3685282323', u'3685282322', u'3009662946', u'1270531030', u'3009662943', u'3367669777', u'3009662949', u'113926540', u'113984695', u'114047815', u'114047817', u'114047799', u'114047811', u'1270531350', u'114047813', u'657999897', u'1629018736', u'1629018734', u'114029689', u'3262155901', u'3262155900', u'114048342', u'3262155902', u'2961370857', u'114048345', u'113983529', u'1270259013', u'1270530983', u'1270530982', u'1270530980', u'1270530987', u'113982537', u'1270530985', u'1270530984', u'1270530989', u'679019025', u'2528097916', u'2528097912', u'113982683', u'113982681', u'114024424', u'113982687', u'113982686', u'2528097853', u'1710882732', u'2060885347', u'2961370855', u'113987771', u'113987773', u'113987775', u'2961370903', u'113987777', u'113987778', u'1629018749', u'1270530785', u'113983534', u'2528097758', u'1270530778', u'113983531', u'2533981159', u'2528097752', u'2528097750', u'2528097756', u'2528097754', u'2103273990', u'114003623', u'2103273992', u'113926505', u'114003626', u'1629015476', u'2103273996', u'2103273997', u'2103273998', u'2103273999', u'1629015479', u'1629018780', u'2527963485', u'114043202', u'2973853844', u'2973853843', u'2973853842', u'2973853841', u'2973853840', u'2937092636', u'2937092635', u'2937092634', u'1629012469', u'2937092632', u'2937092631', u'2937092630', u'1629012465', u'3685289084', u'3685289087', u'3685289086', u'3685289081', u'3685289080', u'3685289083', u'1270530894', u'114024436', u'3009655113', u'2961370852', u'2528097732', u'940960086', u'3685289108', u'3685289109', u'1524810658', u'1524810659', u'1524810656', u'3685289105', u'3685289106', u'3685289107', u'3685289100', u'3685289101', u'3685289102', u'3685289103', u'2284958967', u'1270530955', u'1270530956', u'1270530957', u'1270530958', u'1270530959', u'3685282288', u'3685282289', u'1270531070', u'2973853833', u'2973853836', u'2973853837', u'2973853834', u'2973853835', u'2528097789', u'113983532', u'2973853838', u'2973853839', u'2937092642', u'114024439', u'2937092640', u'2937092641', u'2958019672', u'114024430', u'1629012425', u'3685289033', u'3685289035', u'3685289036', u'1629018777', u'1629018775', u'1629018773', u'113983520', u'114030782', u'1270530788', u'2284957790', u'113980209', u'3262155944', u'3262155946', u'1270530780', u'3262155943', u'1270530782', u'1270530824', u'1270530826', u'2284957792', u'2937092626', u'1270530822', u'2937092627', u'1270530828', u'2528097940', u'2284957794', u'2937092628', u'113984949', u'2973853230', u'2973853231', u'2973853232', u'3685289097', u'1629012426', u'2877123260', u'2528097762', u'2528097811', u'2103274001', u'3685289095', u'2528097814', u'1270531329', u'2528097764', u'2103274004', u'2528097818', u'1270531325', u'2528097768', u'113980206', u'3273715161', u'1270531322', u'1629012473', u'3262155945', u'1270531336', u'3685289104', u'3685289091', u'1629015477', u'114092693', u'2533981119', u'1270530730', u'657999909', u'1270530732', u'1270531014', u'1270530734', u'2533981110', u'1270530736', u'1270530783', u'1270531521', u'1270531527', u'1270531524', u'1629012447', u'1270531346', u'3090013627', u'113981750', u'114054789', u'113981753', u'3685282299', u'113981756', u'114092696', u'2528097961', u'2528097889', u'2528097886', u'2528097883', u'2528097770', u'2528097880', u'2528097872', u'2961370877', u'1282008703', u'113982717', u'113982719', u'657999876', u'657999874', u'657999873', u'4071794986', u'114029018', u'113983547', u'113983545', u'113983543', u'114071598', u'113983541', u'2528097877', u'3685289063', u'2103498014', u'3685289061', u'3685289060', u'3685289067', u'3685289066', u'3685289065', u'2103498015', u'3685289069', u'3685289068', u'3113478171', u'3367602708', u'2937092609', u'2937092606', u'2937092607', u'2937092604', u'2937092605', u'2937092602', u'2937092603', u'2973854051', u'2973854050', u'1629012416', u'2973854052', u'2973854055', u'1629012411', u'2973854057', u'2973854056', u'2973854059', u'2973854058', u'1629012418', u'1283269654', u'1270530915', u'3685289135', u'113989412', u'113989410', u'114054982', u'113981626', u'113981628', u'1270530907', u'1270530905', u'1270531029', u'1270531028', u'3685282318', u'2937092608', u'2528097859', u'3685282316', u'1270531020', u'1270531027', u'3685282311', u'3685282312', u'3685282313', u'3685289148', u'3685289149', u'1629015478', u'3685289140', u'3685289141', u'3685289142', u'3685289143', u'3685289144', u'3685289145', u'3685289146', u'3685289147', u'2528097810', u'114047802', u'114018581', u'1836818376', u'3358133679', u'113986428', u'657999885', u'2528097760', u'657999880', u'114047809', u'2528097785', u'2528097766', u'2103274002', u'2713367975', u'2103274005', u'2713367977', u'2961370911', u'2713367979', u'114003642', u'114048338', u'2533965353', u'2877123261', u'2533965210', u'2528097920', u'679019035', u'2528097922', u'1270531327', u'1422819389', u'2528097841', u'3009662942', u'2528097847', u'2528097844', u'113982690', u'1270531323', u'2597724410', u'2937092633', u'1270530763', u'1270530761', u'1270530767', u'3260554909', u'1270530765', u'2528097787', u'3009662964', u'1270531363', u'1270531366', u'114003617', u'3009662938', u'1270531041', u'114031130', u'3685289076', u'2528098014', u'2103273989', u'4263217242', u'4639231451', u'113981763', u'113981762', u'114049425', u'114049422', u'2103498019', u'114047810', u'1629012452', u'3009655108', u'1629012454', u'1629012456', u'114077434', u'3151496564', u'657999904', u'114077430', u'3685289082', u'2528097862', u'3685282305', u'3685289113', u'3685289112', u'3685289111', u'3685289110', u'3685289117', u'3685289116', u'3659523423', u'3659523422', u'3685289052', u'3685289053', u'3685289050', u'3685289051', u'3685289056', u'3685289057', u'3685289054', u'3685289055', u'3685282291', u'1270530882', u'1270530945', u'3685282292', u'3685282295', u'1270530942', u'114049392', u'3685282296', u'2103281601', u'2103281600', u'2103281603', u'2103281602', u'2103281605', u'2103281604', u'2103281599', u'1270530768', u'1270531063', u'1270531061', u'3032570211', u'3032570213', u'3032570212', u'114056031', u'2286197833', u'113982679', u'114056034', u'3685289029', u'114056036', u'114024445', u'113926532', u'114024447', u'113980564', u'113982677', u'113926535', u'114024442', u'113994323', u'3358135922', u'1629012405', u'113981759', u'3275267700', u'113987535', u'2528097816', u'1270530831', u'1270530930', u'2973853228', u'3685289038', u'2973853227', u'2973853226', u'3685289028', u'114040572', u'1270531016', u'3367669758', u'3367669756', u'1629012388', u'1270531018', u'114040578', u'658856373', u'1283269660', u'1270531332', u'2528097773', u'2528097775', u'1629012434', u'2528097777', u'1270531334', u'2528097779', u'114069266', u'113980218', u'1270531338', u'3262155903', u'3685282308', u'114003619', u'113992726', u'3262155905', u'2103273988', u'1629012438', u'3262155904', u'2533981123', u'2597719656', u'2597719658', u'679019043', u'1271466165', u'114031117', u'4639231452', u'114054977', u'114054975', u'2528105339', u'1270531530', u'1270531534', u'1270531537', u'3262155892', u'3273715163', u'3273715162', u'1270530913', u'1629015520', u'3273715164', u'2937092611', u'2528097971', u'113984129', u'2961370848', u'2961370849', u'2683691668', u'2528097874', u'2877123239', u'2683691667', u'2683691666', u'2961370844', u'2961370845', u'2961370846', u'2961370847', u'1629018805', u'113987759', u'1629018800', u'114003629', u'1629018802', u'2937092638', u'1629018809', u'113987757', u'3151496567', u'1270530758', u'1270530759', u'1270530790', u'2877123238', u'1270530753', u'114049395', u'1270530751', u'1270530757', u'1270530810', u'114031160', u'114031162', u'1629012414', u'3224290707', u'1629012467', u'2103498022', u'1629012409', u'2937092619', u'2937092618', u'2937092615', u'2937092614', u'2937092616', u'1629012407', u'2937092610', u'2937092613', u'2937092612', u'2973854064', u'114003652', u'3009655131', u'2973854060', u'2973854061', u'2973854062', u'2973854063', u'3685289026', u'114048304'])
在矩阵的末尾,它有rc_order。如何使用代码访问rc_order。
由于