||
附注:
阅读说明:贴文时一张张粘贴图片过于繁琐,本文页面文本的图片就略去了,大家可以下载附件的pdf完整文档。为避免网络上大模型抓取给科学网博客带来不必要负载,设定了密码,文档密码为:synchronize
多层网络可视化分析的R软件包muxViz功能概览——软件包使用界面简介
刘杰 编写
武汉纺织大学 非线性科学研究中心
E-mail:liujie at wtu.edu.cn (将at换成@)
摘要:本说明文档为安装好muxViz后便于初学者使用的说明性截图式指南,仅用于对该GUI版本软件包的入门介绍,说明性文字为编写者添加,无科学贡献,含一些与学生讨论知晓的一些使用过程中的软件安装等方面的避坑心得。欢迎转载,转载请一定注明出处。
关键词:多层网络可视化分析,R语言,muxViz软件包
一、 R下载、安装与环境配置等
第一步:转到 https://cloud.r-project.org/ 下载并安装R;
第二步:转到 https://cran.rstudio.com/bin/windows/Rtools/history.html 找到 Rtools Downloads,下载并安装适合你版本的 rtools;
第三步:
(a) 离线安装 ShinyDash 包(转到 https://github.com/trestletech/ShinyDash 下载待会需要的 ShinyDash 包备用;)
(b) 如果网络条件具备,用户可以选择在线安装,在线安装命令如下:
> install_github('trestletech/ShinyDash')
附录:命令窗口成功安装的显示如下:
——————————————————————————————————
> install_github('trestletech/ShinyDash')
Downloading GitHub repo trestletech/ShinyDash@HEAD
── R CMD build ─────────
checking for file 'C:\Users\Administrator\AppData\Local\Temp\RtmpArDNjO\remotes35444c484b01\trestletech-ShinyDash-daffe35/DESCRIPTION' ...
checking for file 'C:\Users\Administrator\AppData\Local\Temp\RtmpArDNjO\remotes35444c484b01\trestletech-ShinyDash-daffe35/DESCRIPTION' ...
✔ checking for file 'C:\Users\Administrator\AppData\Local\Temp\RtmpArDNjO\remotes35444c484b01\trestletech-ShinyDash-daffe35/DESCRIPTION' (463ms)
─ preparing 'ShinyDash':
checking DESCRIPTION meta-information ...
checking DESCRIPTION meta-information ...
✔ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building 'ShinyDash_0.0.1.tar.gz'
* installing *source* package 'ShinyDash' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ShinyDash)
—————————————————————————————————————————————
(c) 类似地,离线安装 session 包,该包安装成功的截图参见附件完整版本指南;
【注意】:此session包如不安装好,运行会出现一层灰色的蒙版(如下图所示),功能运行也会异常。
第四步:在R命令窗口运行:
> devtools::install_github( "manlius/ muxViz")
如果出现已经安装的界面,表明您已经安装过,且现有网上的软件包版本和你的一样,无需重新安装。
第五步:切换到当前工作目录;
GUI交互界面版本:
> setwd("E: \\R\\workdirectory\lGithub\\muxviz-master\\gui-old")
LIB命令行版本:
> setwd("E: \\R\\workdirectory\lGithub\\muxviz-master")
第六步:选择GUI版本或者LIB版本开始多层网络的分析之旅。
比如,选择GUI交互界面版本:打开muxVizGUI.R文件,即,找到muxVizGUI.R所在文件夹,选中点击运行即可。
二、初识muxViz
做好一切安装配置手续之后,
(a) 当选择运行muxVizGUI.R后,可以看到下面的界面:
R控制台显示的相关完整运行提示信息如下:
R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R是自由软件,不带任何担保。
在某些条件下你可以将其自由散布。
用'license()'或'licence()'来看散布的详细条件。
R是个合作计划,有许多人为之做出了贡献.
用'contributors()'来看合作者的详细情况
用'citation()'会告诉你如何在出版物中正确地引用R或R程序包。
用'demo()'来看一些示范程序,用'help()'来阅读在线帮助文件,或
用'help.start()'通过HTML浏览器来看帮助文件。
用'q()'退出R.
[原来保存的工作空间已还原]
> source("C:\\Users\\Administrator\\Downloads\\刘杰搜集 + muxViz软件包及专著指南等 R20230512\\muxViz-master\\muxViz-3.1\\gui-old\\muxVizGUI.R")
载入需要的程辑包:devtools
载入需要的程辑包:usethis
载入需要的程辑包:shiny
Warning: 正在使用‘shiny’这个程序包,因此不会被安装
载入需要的程辑包:shinyjs
Learn different usages for shinyjs and other Shiny tricks:
https://deanattali.com/blog/advanced-shiny-tips
载入程辑包:‘shinyjs’
The following object is masked from ‘package:shiny’:
runExample
The following objects are masked from ‘package:methods’:
removeClass, show
载入需要的程辑包:shinydashboard
载入程辑包:‘shinydashboard’
The following object is masked from ‘package:graphics’:
box
载入需要的程辑包:markdown
载入需要的程辑包:session
载入需要的程辑包:d3heatmap
======================
Welcome to d3heatmap version 0.9.0
Type citation('d3heatmap') for how to cite the package.
Type ?d3heatmap for the main documentation.
The github page is: https://github.com/talgalili/d3heatmap/
Please submit your suggestions and bug-reports at: https://github.com/talgalili/d3heatmap/issues
You may ask questions at stackoverflow, use the r and d3heatmap tags:
https://stackoverflow.com/questions/tagged/d3heatmap
======================
载入程辑包:‘d3heatmap’
The following objects are masked from ‘package:base’:
print, save
载入需要的程辑包:ggplot2
载入需要的程辑包:rCharts
载入需要的程辑包:RColorBrewer
载入需要的程辑包:colourpicker
载入程辑包:‘colourpicker’
The following objects are masked from ‘package:shinyjs’:
colourInput, colourPicker, runExample, updateColourInput
The following object is masked from ‘package:shiny’:
runExample
载入需要的程辑包:colorspace
载入需要的程辑包:digest
载入需要的程辑包:googleVis
Welcome to googleVis version 0.7.1
Please read Google's Terms of Use
before you start using the package:
https://developers.google.com/terms/
Note, the plot method of googleVis will by default use
the standard browser to display its output.
See the googleVis package vignettes for more details,
or visit https://mages.github.io/googleVis/.
To suppress this message use:
suppressPackageStartupMessages(library(googleVis))
载入需要的程辑包:gplots
载入程辑包:‘gplots’
The following object is masked from ‘package:stats’:
lowess
载入需要的程辑包:rgl
载入需要的程辑包:igraph
载入程辑包:‘igraph’
The following objects are masked from ‘package:stats’:
decompose, spectrum
The following object is masked from ‘package:base’:
union
载入需要的程辑包:mapproj
载入需要的程辑包:maps
载入需要的程辑包:rgdal
载入需要的程辑包:sp
Please note that rgdal will be retired during 2023,
plan transition to sf/stars/terra functions using GDAL and PROJ
at your earliest convenience.
See https://r-spatial.org/r/2022/04/12/evolution.html and https://github.com/r-spatial/evolution
rgdal: version: 1.6-6, (SVN revision (unknown))
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.5.2, released 2022/09/02
Path to GDAL shared files: C:/Program Files/R/R-4.2.3/library/rgdal/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 8.2.1, January 1st, 2022, [PJ_VERSION: 821]
Path to PROJ shared files: C:/Program Files/R/R-4.2.3/library/rgdal/proj
PROJ CDN enabled: FALSE
Linking to sp version:1.6-0
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
载入需要的程辑包:OpenStreetMap
载入需要的程辑包:fields
载入需要的程辑包:spam
Spam version 2.9-1 (2022-08-07) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
载入程辑包:‘spam’
The following objects are masked from ‘package:base’:
backsolve, forwardsolve
载入需要的程辑包:viridis
载入需要的程辑包:viridisLite
载入程辑包:‘viridis’
The following object is masked from ‘package:maps’:
unemp
Try help(fields) to get started.
载入需要的程辑包:clue
载入需要的程辑包:d3Network
载入需要的程辑包:Matrix
载入程辑包:‘Matrix’
The following object is masked from ‘package:spam’:
det
载入需要的程辑包:networkD3
载入需要的程辑包:dplyr
载入程辑包:‘dplyr’
The following objects are masked from ‘package:igraph’:
as_data_frame, groups, union
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
载入需要的程辑包:RSpectra
载入需要的程辑包:tidyverse
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ lubridate 1.9.2 ✔ tibble 3.2.1
✔ purrr 1.0.1 ✔ tidyr 1.3.0
✔ readr 2.1.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ lubridate::%--%() masks igraph::%--%()
✖ purrr::%||%() masks rCharts::%||%()
✖ tibble::as_data_frame() masks dplyr::as_data_frame(), igraph::as_data_frame()
✖ purrr::compose() masks igraph::compose()
✖ tidyr::crossing() masks igraph::crossing()
✖ tidyr::expand() masks Matrix::expand()
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
✖ purrr::map() masks maps::map()
✖ tidyr::pack() masks Matrix::pack()
✖ readr::read_file() masks rCharts::read_file()
✖ lubridate::show() masks Matrix::show(), sp::show(), colorspace::show(), shinyjs::show(), methods::show()
✖ purrr::simplify() masks igraph::simplify()
✖ tidyr::unpack() masks Matrix::unpack()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Listening on http://127.0.0.1:4044
Loading language file...
+ Done!
Version: June 20, 2014.
Command: /usr/bin/multiplex-infomap_windows
Call: ./multiplex-infomap [-s <seed>] [-N <attempts>] [-teleportrate <rate>] [-switchrate <rate>] [-proportionalswitch|-uniformswitch] [-noselflinks|-selflinks] [-multiplex|-aggregated|-expanded] [-classical|-physical] [-clusters <nodeassignments.txt>|-guess <nodeassignments.txt>] [-smartinit] [-nodenames <nodenames.txt>] network_level1.net network_level2.net [network_level3.net ... network_levelN.net] level_network.net
Usage: fanmod <(at least) 17 basic input parameters as specified>
input parameters:
-----------------
algorithm options
1- subgraph (motif) size [default: 3]
2- # of samples used to determine approx. # of subgraphs [100000]
3- full enumeration? 1(yes)/0(no) [1]
sampling probabilities will be input at end of command line, variable #!
input file
4- infile name
5- directed? 1(yes)/0(no) [1]
6- colored vertices? 1(yes)/0(no) [0]
7- colored edges? 1(yes)/0(no) [0]
random networks
8- random type: 0(no regard)/1(global const)/2(local const) [2]
9- regard vertex colors? 1(yes)/0(no) [0]
10- regard edge colors? 1(yes)/0(no) [0]
11- reestimate subgraph number? 1(yes)/0(no) [0]
12- # of random networks [1000]
13- # of exchanges per edge [3]
14- # of exchange attempts per edge [3]
output file
15- outfile name
16- outfile format 1(ASCII - human readable)/0(CSV - for easy parsing) [1]
17- create dumpfile? 1(yes)/0(no) [0]
sampling probabilities (if NOT full enumeration)
18->25 (depending on subgraph size) [.5]
Loading language file...
+ Done!
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::: Welcome to muxViz
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: muxViz: Tool for Multilayer Analysis and Visualization
:: Copyright (C) 2013-2017 Manlio De Domenico
:: School of Computer Science and Mathematics
:: Universitat Rovira i Virgili (Tarragona, Spain)
:: This software is released under GNU GPL v3:
:: http://www.gnu.org/copyleft/gpl.html
:: Version: 2.0.1
:: Last update: 27 January 2018
:: You are running from Windows
:: build 19044
:: R version 4.2.3 (2023-03-15 ucrt)
此时软件的GUI界面出现,下图为打开的页面:
文件菜单下,导入网络数据界面如下:
文件菜单下,边列表显示界面如下:
文件菜单下,控制台页面如下:
文件菜单下,载入和保存session界面:
查询菜单对应的页面:
诊断菜单下,统计特征量计算界面:
诊断菜单下,关联性特征量计算:
诊断菜单下,中心性特征量计算:
诊断菜单下,三元闭包特征量计算:
诊断菜单下,模体特征量计算:
诊断菜单下,最大连通分支特征量计算:
诊断菜单下,社区分析特征量计算:
诊断菜单下,网络层特征量计算:
诊断菜单下,可视化渲染参数设定:
可视化菜单下,网络布局相关参数设定:
可视化菜单下,图形化相关参数设定:
可视化菜单下,多重特征相关参数设定:
可视化菜单下,层内相关参数设定:
可视化菜单下,节点相关参数设定:
可视化菜单下,连边相关参数设定:
可视化菜单下,图形导出的相关参数设定:
可削减性(约简)菜单下,图形化相关参数设定:
动力学分析菜单下,图形化相关参数设定:
图形要素菜单下,节点类型图形化相关参数设定:
图形要素菜单下,连线类型图形化相关参数设定:
图形要素菜单下,配色类型图形化相关参数设定:
图形要素菜单下,地图类型图形化相关参数设定:
数据菜单下,一些可下载的多层网络数据库:
常用多层数据集:
https://comunelab.fbk.eu/data.php
muxViz的帮助菜单:
附录:
'Import' tab/'Config file' tab to select and open the configuration file.
The configuration file is a ASCII file including the list of layers to be included in a multiplex, the corresponding labels and the possible layout file to define node properties (e.g., ID, labels, geographical coordinates, etc).
Format of a configuration file: (click here to open an example)
path_layer_X;label_layer_X;path_layout_layer_X
where
path_layer_X: [mandatory] specify the path and the filename to the edges list to be used as layer
label_layer_X: [optional] specify the label to be used in the rendering for that layer
path_layout_layer_X: [optional] specify the path and the filename to the file containing information about nodes
Each line in the configuration file indicates one layer, and the network format for each layer will be \standard edges list\ (see below).
If the multilayer is not edge-colored (i.e., inter-links are allowed), only one line is specified in the configuration file, with format:
path_multilayer;path_to_layers_info;path_to_layers_layout
where
path_multilayer: [mandatory] specify the path and the filename to the extended edges list to be used
path_to_layers_info: [mandatory] specify the path and the filename to the file containing information about layers
path_to_layers_layout: [mandatory] specify the path and the filename to the file containing information about nodes
In this case the network format will be \extended edges list\ (see below).
A typical edges list is expected to be a file with at most three columns, giving the list of edges from a node (first column) to other nodes (second column), possibly weighted by an integer or floating number (third column). For instance:
1 2 0.5
1 3 1.4
...
18 124 0.1
is a typical weighted edges list. Non-sequential integer IDs can be used by checking the appropriate box before importing the networks. In this second case, it is mandatory to provide a layout file (see next section) reporting each node label (field nodeLabel). This would look like
nodeLabel
alice
bob
john
david
...
An extended edges list is a new format that allows to specify all possible types of links, intra- and inter-layer. Each line specifies the source node (first column) and the source layer (second column), the destination node (third column) and the destination layer (fourth column), possibly weighted by an integer or floating number (fifth column). For instance:
1 1 2 1 0.5
1 1 3 1 1.4
...
18 2 124 2 0.1
is a typical weighted extended edges list. For label-based extended edges lists, the same rules of the standard edges lists apply.
Format of a layout file: (click here to open an example)
The first line of the file must specify the name of the correponding node attributes. Allowed attributes:
nodeID: [mandatory] numerical integer id to identify each node
nodeLabel: [optional] string specifying the label attribute
nodeX: [optional] float value specifying the Cartesian coordinate x for the layout
nodeY: [optional] float value specifying the Cartesian coordinate x for the layout
nodeLat: [optional] float value specifying the latitude for the geographical layout
nodeLong: [optional] float value specifying the longitude for the geographical layout
The order of the columns is not relevant. If nodeLat and nodeLong are specified, they will be automatically converted to Cartesian coordinates (through Mercator projection).
The properties of each node in the multilayer must be specified or default values will be used (i.e., automatic labeling and layouting). If the number of nodes in the network is different from the number of nodes provided in the layout file, it will be assumed that something is wrong with the layout file and default values will be used.
Format of a layer-info file: (click here to open an example)
The first line of the file must specify the name of the correponding layer attributes. Allowed attributes:
layerID: [mandatory] numerical integer id to identify each layer
layerLabel: [optional] string specifying the label attribute
The order of the columns should not be relevant.
'Import' tab/'Import' tab to import the networks in your configuration file.
The network files are expected to be in edges list format. For edge-colored networks, one file for each layer with format
nodeID1 nodeID2
in the case of unweighted edges list, or
nodeID1 nodeID2 weight
in the case of weighted edge list.
The nodes ID are expected to refer to the same node in each layer. For instance, the ID 1234 with label 'myNode' is expected to indicate the same entity in all layers.
The case of non-edge-colored network is a generalization of the above rules.
'Diagnostics' tab to set up and start the calculation.
The properties of the multilayer network are expected to be set up from the tab 'Import Networks' within the File menu.
Successively, it is possible to calculate different types of diagnostics:
Statistics: basic network descriptors per layer, separately;
Correlation: calculate edge overlap and inter-layer degree-degree correlations;
Centrality: calculate several descriptors of influence/importance in the network. It is possible to choose to perform calculations in each layer separately or accounting for the whole multiplex structure;
Triads: local and global clustering/transitivity analysis. It is possible to choose to perform calculations in each layer separately or accounting for the whole multiplex structure;
Motifs: analysis of motifs, fundamental building blocks of (multilayer) complex networks;
Community: unveil the community structure according to different methods. It is possible to choose to perform calculations in each layer separately or accounting for the whole multiplex structure.
The results can be analyzed using interactive analytic tools. Annular visualization of centrality descriptors is allowed and accessible through the 'Annular Viz' tab. It is worth remarking that annular visualization is possible only after centrality diagnostics have been calculated.
'Visualization' tab to set up the visualization.
Several sub-tabs are present, each one allowing to set up particular graphic options.
The 'Layout' sub-tab controls the algorithms responsible for the position of nodes and layers in the network. The 'Graphics' sub-tab controls graphic options such as the shift between layers, the lights for the openGL rendering, the plot title, and so on. Note that changing some of those options might require the layout to be re-applied. Options requiring re-application of layout are highlighted.
The remaining sub-tabs control the appearance of 'Multiplex', 'Layers', 'Nodes' and 'Edges'.
Once the set up is completed, click on the 'Render Network / Apply Viz Options' button.
Note that it is possible to export the visualization either to a png or to a web page, by means of export buttons available in 'Export' sub-tab.
This module allows to build nice animated visualizations corresponding to dynamical processes on the top of a multilayer network. For instance, one can visualize the movements of one (or more) random walker(s) in the network, or the spreading of an epidemics or of a meme in a social network, the traffic (and possible congestions) in a transport/communication network, etc.
The idea is to feed the module with a 'timeline' file where the change of the state of nodes and edges in the multilayer network are specified at each time step. The 'state' of an object can be altered by changing its color and/or its size. For instance, in the case of an epidemics spreading in a country, the size of each node (e.g., a metapopulation describing a city) can be proportional to the population and the color can encode the amount of infected people. This description allows a wide variety of dynamics to be represented and visualized: for instance, setting the size of nodes and edges to zero when required, it is possible to visualize a time-varying multilayer network where nodes and edges appear or disappear over time.
Format of a timeline file: (click here to open an example)
The first line of the file must specify the name of the correponding timeline attributes. Allowed attributes:
timeStep: [mandatory] numerical integer id to identify time steps
labelStep: [mandatory] string specifying the snapshot label
entity: [mandatory] string specifying if the object to modify is 'node' or 'edge'
layerID: [mandatory] numerical integer id to identify each layer
nodeID: [mandatory] numerical integer id if entity is 'node' and string (e.g., '3-7', corresponding to the link from node 3 to node 7) if entity is 'edge'.
color: [mandatory] Hex color string (e.g. 11DADA) specifying the color to be assigned
sizeFactor: [mandatory] float value specifying the relative size of the entity, scaling with respect to the default size
The order of the columns is not relevant. If the network has L layers and you want to include the aggregate network in the visualization, then use L+1 in the layerID field for it.
To keep users with the freedom to use their favorite video making software, the output of muxViz consists of png files representing the temporal snapshots of the dynamics. Snapshots are saved in the folder 'export/timeline/project_name'. Successively, users can use their favorite software to merge the sequence of snapshots into a single video. We recommend to use FFmpeg with the following parameters:
ffmpeg -r 1 -i /path/xyz_%05d.png -c:v libx264 -pix_fmt yuv420p -r 25 output_file.mp4
Reduce the dimensionality of the multiplex.
First, set up the 'Algorithms' to be used for the calculation. The output will be displayed in the 'Results' sub-tab.
If you use muxViz for your analysis and visualization of multilayer networks, you should cite the following paper:
M. De Domenico, M. Porter and A. Arenas, MuxViz: a tool for multilayer analysis and visualization of networks, Journal of Complex Networks 3, 159 (2015) [Open]
muxViz is based on several algorithms. Please, cite the papers corresponding to the algorithms used in your research.
Software released under GPLv3
Developed by Manlio De Domenico
School of Computer Science and Mathematics, Universitat Rovira i Virgili
Visit the project page or the Github repo
This work has been partially supported by European Commission FET-Proactive project PLEXMATH (Grant No. 317614), the European project devoted to the investigation of multi-level complex systems and has been developed at the Alephsys Lab.
I am in debt with A. Arenas for proposing this project, with Mason A. Porter and with the muxViz community for invaluable suggestions and feedbacks.
I would like to thank Inderjit S. Jutla, Lucas G. S. Jeub, and Peter J. Mucha for making their code about multislice community detection available.
Finally, I would like to acknowledge the precious help of S. Agnello in designing and testing this Graphical User Interface to muxViz.
muxViz makes use of many packages and its license is compatible with the license of each used package. muxViz is Open Source and makes use of free software only: R (GNU GPLv2) and muxNet (Next release, GNU GPLv3 License, see the original license).
This code has no warranty whatsoever and any kind of support is provided. You are free to do what you like with this code as long as you leave this copyright in place. Please, explicitly cite muxViz if you find it useful for your visualizations and analyses.
(C) Copyright 2013-2017, Manlio De Domenico (manlio.dedomenico at urv.cat)
muxViz is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
muxViz is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the package. If not, see www.gnu.org/licenses/.
muxViz is a free and open-source platform that has been used for scientific purposes in a variety of disciplines, including computational social science, computational neuroscience, computational biology, computational psycholinguistics, multi-modal transportation engineering and physics.
Since January 2016, muxViz is periodically updated and maintained for free by its developer and its enthusiastic community of users (the muxVizers).
If muxViz helps you with your research and reduces your time to develop, you can give us a cup of good coffee :)
(b) 当选择LIB命令行版本时,你看到的是这样的界面:
运行官方给出的实例,相关代码即返回交互出现的全部信息为:
R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R是自由软件,不带任何担保。
在某些条件下你可以将其自由散布。
用'license()'或'licence()'来看散布的详细条件。
R是个合作计划,有许多人为之做出了贡献.
用'contributors()'来看合作者的详细情况
用'citation()'会告诉你如何在出版物中正确地引用R或R程序包。
用'demo()'来看一些示范程序,用'help()'来阅读在线帮助文件,或
用'help.start()'通过HTML浏览器来看帮助文件。
用'q()'退出R.
[原来保存的工作空间已还原]
> devtools::install_github("manlius/muxViz")
Skipping install of 'muxViz' from a github remote, the SHA1 (69c17525) has not changed since last install.
Use `force = TRUE` to force installation
> library(ggplot2)
> library(ggraph)
> library(grid)
> library(igraph)
载入程辑包:‘igraph’
The following objects are masked from ‘package:stats’:
decompose, spectrum
The following object is masked from ‘package:base’:
union
> library(muxViz)
> # build edge-colored network by specifying layers
> L <- 3
> N <- 100
> node_tensor <- list()
>
> # Generate an edge-colored network
> g <- sample_pa(n = N, power = 1, m = 1, directed = FALSE)
> g_list <- list()
> for (l in 1:L) {
+ g_list[[l]] <- delete_edges(g, sample(E(g), floor(0.2 * length(E(g)))))
+ node_tensor[[l]] <- as_adjacency_matrix(g_list[[l]])
+ }
> layer_tensor <- diagR(c(1, 1), 3, 1) + diagR(c(1, 1), 3, -1)
> M <- BuildSupraAdjacencyMatrixFromEdgeColoredMatrices(node_tensor, layer_tensor, L, N)
> # PageRank
> pr <- GetMultiPageRankCentrality(M, L, N)
> # Degree versatility
> deg <- GetMultiDegree(M, L, N, isDirected = F)
在相关文件夹(C:\Users\Administrator\Downloads\刘杰搜集 + muxViz软件包及专著指南等 R20230512\muxViz-master)下面会返回相关的输出结果。
本文用于备忘,不可避免存在错漏。
最近因为一位朋友的网上讨论重新捡起了这个软件包用一下,新版本在细节上我也不太熟悉,欢迎大家留言讨论。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-24 01:10
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社