来源:http://mp.weixin.qq.com/s?src=3×tamp=1473658122&ver=1&signature=bD9pCtnMBgsLeYrkVqUfTmc0UOW5iXz0IF7FuIfEqbazmTvJJReaTdSd8UYxNXZNqNGS*vH81z7HwimQUzUYeDTleHUAJetizsNEnSdaNysV4c7shCVTQq7BW24lLSCHSdMPBuRhS6Zgw3Udw4CuDVdv1L1KbhLkVxYVnRJBsAE=
P J Lamberson的主页(http://social-dynamics.org/gephi-faq/)
2016-06-18
UCLA 的 Communication Studies 系助理教授 P J Lamberson 在UCLA进行着两门本科生课程的教学工作, 一门是Social Networking (COMM ST 156),另一门是Methodologiesin Communication Research (COMM ST 150)。在此之前(即在他加入 UCLA之前), 他在凯洛格商学院担任着高级讲师的职位(Senior Lecturer in the Management and Organizations Department atthe Kellogg School of Management),同时他还兼任西北大学复杂系统研究所的副主任一职(the Associate Director of the Northwestern Institute on ComplexSystems (NICO))。开设课程期间,他在凯洛格商学院MBA 和 EMBA 课程中跟随他学习社会动力学、网络建模与分析的学生做了大量相关研究工作,其中经常要使用网络分析和可视化软件开源程序包 Gephi。与使用任何不熟悉的软件产品的过程一样,使用过程中,学生们经常碰到一些技术障碍或使用上的困惑、问题。由此他认为:从软件使用者视角编译一个Gephi 常见问题集合FAQ作为官方提供的FAQ的补充,将有助于初学者掌握并灵活使用这个软件。因此,P J Lamberson检视了近年来与学生交流使用心得的旧的电子邮件,列出了一些Gephi 使用过程中有代表性的问题,在此,将其汉化并张贴在此。这里提及的一些最常见的典型问题也是我经常遇到的,而且网上一时很难找到解决方案,考虑初学者的不易,为促进软件的使用经验传播,给出它所列示的简单答案供大家参考。
使用者视角:
Q1. How can I filter thenetwork so that I only see the largest connected component?
如何使用过滤功能,得到整个网络的最大连通分支?
A.In the statistics window, click the run button next to connected components.Then, switch to the filters window. Select the Attributes folder, then thePartition folder. Then drag the “Component ID (Node)” filter down tothe Queries window where it says “Drag filter here”. You can selectwhich component(s) you want to see by clicking on the check boxes next to thecomponent numbers where it says “Partition (Component ID) Settings”You can see what fraction of the nodes belong to each component as a percentagenext to each component number, so if you only want to see the largest connectedcomponent, chose the one with the highest percentage. Then click Filter.
在统计信息(Statistics)窗口中,单击旁边的“连通分支(connected components)”按钮、点击运行(run)。然后,切换到筛选器(Filters)窗口。选择中“属性文件夹(Attributes folder)”,然后选择“分区文件夹(Partition folder)”。然后将”节点组件 ID (Node)”筛选器(filter)拖至查询窗口,它会提示:”在这里拖筛选器”。您可以看到节点的哪一部分属于每个组件(作为百分比旁边每个组件的数量),所以,如果你只想看到最大的连通的分量,选择比例最高的那个即可。然后单击筛选“Filter”按钮即可。
Q2. When I try to export mygraph as a pdf, Gephi clips the node labels so that I can’t see all of them.How do I fix this?
当我试着将我图导出得到的图为 pdf或者png,svg图形文件时,Gephi 似乎会剪辑节点标签,以致于保存的图中不能看到他们所有的标签。就如下图所示,标签出现缺失,如何解决此问题?
A.There is no good way to fix this, but there is a work around. When Gephiexports the image, it only pays attention to nodes and links, not the labels,when it decides where to clip the image. To make sure you get the full image,you can add some nodes around the edges of where you want to clip the image. Todo this, there is a tool on the left side of the overview window that lookslike a pencil (the top one of the two pencils). Just click on the screen withthis tool where you want the new node to appear. Put one node on the left,right, top and bottom at the boundary of where you want the image to beclipped. Then, so these nodes don’t actually show up, you can resize them sothat they’re so small that they can’t be seen. To do this, select the sizingtool, which looks like a little diamond on the left side of the overviewwindow. Then click on the node that you want to reize and drag the mouse downto make the node smaller. This should fix the problem.
A.说实话,暂时没有好的方法来修正软件这个瑕疵,但存在如下的一种变通处理方法(真心讲,PJ提供的这个方法这个真的很实用!)。产生这一问题的症结在于:当 Gephi 导出各级分辨率的图像时,在软件决定在哪剪辑图像时,除了设置时边缘参数的确定外,它只注重节点和链接,不是标签在哪,字体有多大,是否超出输出图片的预先设定的范围了。于是不可避免的会将长标签或者大字号标签残缺显示。:(
若要确保你所得到的完整的图像,可以添加“四个小的孤立节点”到要剪辑图像的“天头、地脚、左、右边“的边缘处。这个很容易操作:在窗体左边工具栏有一个看起来像一支铅笔的按钮(即概览窗口左侧的工具栏,顶部两支铅笔之一,一个画节点,一个画连线的)。只需点击显式屏幕窗口,使用此工具在“天头、地脚、左、右边“绘制四个要显示的新节点(即,把一个节点放在左、 右、 顶部和底部在你想要的图像的边界要被裁剪处)。然后,由于导出图形中,这些节点实际上不露面,因此,使用者可以调整它们的大小,让他们小到看不见即可。要做到这一点也很容易,你可以选择确定节点大小工具,它看起来像一个小的钻石,在左边的概览窗口工具栏中。然后,点击你想预设大小(拖动鼠标使节点尺寸变小)。一般这种方法应该能解决这类问题。但要注意的是,不要保存此时的*gephi文件,因为你添加了额外的四个节点,网络特征量会发生很多变化,所以,这只是一个导出图形的“小伎俩”,我们只能期待众多软件开发者能够在将来的版本中努力改进这一瑕疵。
Q3.I imported a graphml data file and I’m trying to use eignevector centrality(PageRank, HITS, …) to identify important nodes, but when I try to run theeigenvector centrality calculation from the Statistics window nothing happens.How do I fix this?
当我导入 graphml 数据文件,我想使用特征向量中心性(eignevectorcentrality)指标(PageRank, HITS, …) 来标识重要的节点,但是,当我试着从统计窗口运行特征向量中心计算,什么都不会发生,发现软件没任何反应。如何解决此问题?
A.The problem is that the graphml file that you imported already has (empty)columns corresponding to the measures that you want to calculate and Gephiwon’t overwrite them. To fix this, you first have to delete those columns. Gointo the data laboratory tab and delete any of the columns that have to do withmeasures of centrality like eigenvector centrality, closeness centrality,betweeness centrality, page rank, anything that looks like that.Onceyou have done that go back to the overview window and then run the calculationthat you want under the statistics tab. If the little window pops up with thegraphs, then everything is working, if it doesn’t then you need to go back tothe data laboratory and delete some more columns.
问题可能是,你已经导入的 graphml 文件含有某一列(空列)对应于您想要计算的测度指标,而Gephi 软件通常不会覆盖它们。要解决此问题,首先要删除这些列。你需要进入data laboratory tab栏目,选择数据实验室(datalaboratory)选项卡,删除像特征向量中心性,接近中心性,介数及PR值等任何相关测度指标列。完成这个删除操作后,回到概览窗口,然后,运行您所希望的在统计选项卡下的测度指标计算,一般会起作用。如果还不行,则您需要回到数据实验室,并重复刚才的操作(删除一些多余的列)。
Q4.I imported a node attribute that I want to use to resize my nodes, but it isn’tshowing up under the ranking tab. How do I fix this?
我导入了一个新的node attribute用于调整相关节点属性,但它却没有被显示在排序选项卡(ranking)下的节点属性下拉菜单中。如何解决此问题?
A.The most likely problem is that the node attribute is identified as the wrongtype of data — probably a String, when it needs to be a numeric type such asBigInteger. The easiest way to fix this is to click Duplicate column in thedata laboratory and then be sure to select a numeric type (e.g. BigInteger orBigDecimal) for the duplicated column. Once you’re done you can delete theoriginal node attribute column. The duplicated numeric column should now beaccessible in the rankings window.
最有可能的发生问题是:节点属性被标识为错误的数据类型 — — 可能是一个字符串,当它需要一个数值类型如 BigInteger。解决此问题的最简单方法是:单击数据实验室中的重复列,然后,对重复列一定要选择一个数值类型(如BigInteger 或 BigDecimal)。一旦完成,你就可以删除原始节点属性列。,现在在排名窗口应该可以访问重复的数字型列。
Q5.I’m trying to import an adjacency matrix that I have in a csv file, but I keepgetting the java runtime error“java.lang.RuntimeException: java.lang.NullPointerException” What do I do?
我试图导入邻接矩阵,我有在 csv 文件中,但我会不断给运行时错误提示“java.lang.RuntimeException:java.lang.NullPointerException”,同时报告,空指针异常,这该怎么办?
A.For some reason, when importing an adjacency matrix Gephi expects a csv filewith semicolon separators, not commas. Just open your csv file using a simpletext editor like NotePad or TextEdit and then use the Find/replace command tochange all of the commas to semicolons.
由于某些原因,当Gephi导入一个邻接矩阵csv 文件时,Gephi期望的csv不是逗号,而是以分号分隔形式。建议使用简单的文本编辑器,如记事本或文本编辑去打开您的 csv 文件,然后,使用查找/替换命令所有的逗号改为分号。
Q6.I have a network in which there are different types of nodes (e.g. doctors andpatients) and I would like to color the different types using different colors.How do I do this?
我有一个网络中,有不同类型的节点 (例如医生和病人)和我希望不同的类型填充不同颜色。怎么办?
A. You need to import a new node attributethat gives the type for each node. To add a node attribute, create aspreadsheet with one column labeled Id that contains a list of all of the namesof the nodes in your network. Be sure these are the same names that appearunder the ID column in the Data Laboratory in Gephi. Then add additionalcolumns to the spreadsheet that give the node attributes for each node. Forexample, you might have a column called “type” with entries like”doctor” or “patient” that tells whether the correspondingnode is a doctor or a patient. Once you have created your spreadsheet, exportit as a csv. Now, go back to Gephi with your existing network file open. UnderData Laboratory, select Import Spreadsheet, and choose Nodes Table. Make surethat the button “Force Nodes to be Created as New Ones” is not checked. andimport the spreadsheet. This should add a new column to the nodes table in thedata laboratory. Then, using the partition tab, you can color the nodesaccording to this attribute.
您需要给每个类型的节点导入一个新的节点属性。具体操作时,若要添加一个节点属性,你需要创建一个电子表格,有一列标记为包含所有在您的网络中节点的名称的列表的 Id。请确保这些数据实验室在 Gephi 的 ID 列下显示的名称相同。然后将其他列添加到电子表格,给每个节点的节点属性。例如,您可能有一个名为”类型”列与像”医生”或”患者”告诉相应节点是否是一名医生或病人的条目。一旦你创建了您的电子表格,请将它导出为 csv。现在,回到 Gephi 与您现有的网络文件打开。在“数据实验室”栏目下,选择“电子表格导入”按钮,并选择“节点表”。请确保按钮 “ForceNodes to be Created as New Ones” 未被选中,然后导入电子表格。这将添加新的属性列到数据实验室节点表中。然后,使用分区选项卡,您可以根据此属性节点添加颜色。
Q7. I’m trying to import an adjacency matrixfrom a csv file, but I’m getting the error “java.lang.RuntimeException: java.lang. Exception: Inconsistent number of matrix linescompared to the number of labels” What do I do?
我试图使用 csv 文件导入的方式导入反映节点间邻接关系的邻接矩阵,但我得到错误消息”java.lang.RuntimeException:java.lang. Exception: Inconsistent number of matrix lines compared to thenumber of labels”即,“与实际标签数相比,矩阵行的数目与之不一致”,这该怎么办?
A. One thing to try is removing any extraspaces from your csv file. Sometimes these trip up the import. Open the csvfile using a simple text editor like NotePad or TextEdit, and then usefind/replace to remove any spaces. Save the adjacency matrix and then tryimporting it again.
可以尝试的一件事是,试着从您的 csv 文件中删除任何多余的空格。有时,这些会影响导入过程。使用简单的文本编辑器打开该文件(如记事本或文本编辑该 csv 文件),然后使用“查找/替换”删除的任何空格。保存邻接矩阵为csv,然后尝试再次导入它。
Q8. I’m trying to import an edge list, but Ijust get a bunch of nodes with no edges. What’s going wrong?
我试图导入边列表,但我得到一串的节点,并没有边。是哪出问题了呢?
A. Make sure that when you’re importing theedge list from the data laboratory that you select “Edges Table” in the drop down menuand not “Nodes Table.” Otherwise it just thinks your bringing in alist of nodes.
请确保当您正导入边列表从数据实验室你选择”边表”在下拉菜单中,确认并不是在”节点表”中。否则,它只是认可你节点列表中带来的边。
Q9.I want to add labels to my network, but when I click the little black T, nolabels show up (or the label isn’t what I want it to be). How do I get the(right) labels?
我想要将标签添加到我的网络,但,当单击小黑 T,没有标签显示(或标签不是我想要的)。怎么得到正确的标签?
A.You need to feel Gephi which column you want it to use for the labels. Bydefault, Gephi uses the data in the column “Labels.” To change whichcolumn is used, from the over view screen, click the small triangle in thelower right hand corner of the Graph window, which will reveal an extrasettings pane. Then choose the Labels tab. On the far right hand side of thiswindow, click “Configure…” then put a check mark next to any of theattributes that you would like to show up as labels. Alternatively, in the DataLaboratory, you can just copy the column that you want to use as labels in tothe labels column.
你需要检视 Gephi,看看哪一列是您想要使用的标签。默认情况下,Gephi 在使用数据列中” Labels “列。若要更改使用哪一列,从查看屏幕,请单击将揭示额外设置窗格中的图形窗口右下角的小三角形。然后选择标签选项卡。在远离右手边的这个窗口,单击” Configure…”然后放在任何你想要显示为标签的属性旁边的复选标记。换句话说,你只需在数据实验室里复制您想要用作标签到该列即可。
Q10.When I try and import an edge list, Gephi says I need Source and Targetcolumns, but I already have Source and Target columns. What’s going on?
当我试着导入边列表时,Gephi 说,我需要源列和目标列,但我已经有源列和目标列。这是怎么回事?
A.There are probably extra spaces after the words Source and Target in yourcolumn headers. If you delete these spaces you should be able to import theedge list.
在源和目标列,您的列标题中的单词后有可能多余的空格。如果您删除这些空格,你应该能够导入边缘列表。
共享此文章:
点击以分享到 X(在新窗口中打开)
X
点击分享到 Facebook (在新窗口中打开)
赞 正在加载……