如何将邻接矩阵转换为发生率矩阵,反之亦然?(How do you transform Adjacency matrices to Incidence matrices and vice-versa?)
我们假设矩阵如下:(N = 4)
邻接:
0110 1001 1001 0110
发病率:
1100 1010 0101 0011
你怎么能得到Incidence矩阵只有邻接矩阵,反之亦然?
PS:我从一个.txt文件得到的邻接矩阵,我已经读入一个数组并通过以下算法得到它:
int read(){ ifstream graf("graf.txt"); if(graf.is_open()){ graf >> n; for (int i=0; i < n; i++) { for(int j = 0; j<2; j++) graf >> Graf[i][j]; } } graf.close(); return 0; } void adj() { for (int i=0; i<n; i++) for (int j=0; j<n; j++) sz[i][j] = 0; for (int i=0; i<n; i++) for (int j=0; j<2; j++) {sz[Graf[i][j]-1][Graf[i][j+1]-1] = 1;} for (int i=0; i<n; i++) for (int j=0; j<n; j++) sz[j][i] = sz[i][j]; }
Let's say the matrices are the following: (N = 4)
Adjacency:
0110 1001 1001 0110
Incidence:
1100 1010 0101 0011
How can you get the Incidence matrix from having just the Adjacency one, and vice-versa?
P.S: The Adjacency Matrix I'm getting from a .txt document, which I've read into an array and got it by the following algorithm:
int read(){ ifstream graf("graf.txt"); if(graf.is_open()){ graf >> n; for (int i=0; i < n; i++) { for(int j = 0; j<2; j++) graf >> Graf[i][j]; } } graf.close(); return 0; } void adj() { for (int i=0; i<n; i++) for (int j=0; j<n; j++) sz[i][j] = 0; for (int i=0; i<n; i++) for (int j=0; j<2; j++) {sz[Graf[i][j]-1][Graf[i][j+1]-1] = 1;} for (int i=0; i<n; i++) for (int j=0; j<n; j++) sz[j][i] = sz[i][j]; }
原文:https://stackoverflow.com/questions/22380139
最满意答案
#
标记被视为文件夹标记,因此部署到/a/b/c/v0.0#app.war
该应用程序将在
http://some.url:port/v0.0/app
The
#
mark gets treated as if it is a folder marker so deploy to/a/b/c/v0.0#app.war
And the application will be available at
http://some.url:port/v0.0/app
相关问答
更多-
除了IIS和Apache,还有没有其它的服务器程序[2022-05-09]
tomcat -
答案可以在以下网址找到: https : //tickets.puppetlabs.com/browse/MODULES-1545 有一个例子显示了在哪里提供实际的战争文件名,包括版本号,在哪里提供它没有版本号。 后一个参数确定用于战争文件副本的名称,它是设置上下文根的副本。 重要Puppetlabs Tomcat模块(版本1.6.1)有一个错误,它会阻止它识别更新的war文件。 一位名叫Daniel Haag的人在2015年11月为这个bug提供了一个修复程序。它只适用于你应用Daniels补丁。 为什么 ...
-
在tomcat中解析路径9(Resolving path in tomcat 9)[2023-04-17]
我检查了这个答案 - 似乎正在做一些你需要的东西: 从tomcat读取属性 我很快就从这个问题上得到了如下的结果: <%= new File(System.getProperty("catalina.base"), "conf").getAbsolutePath() %> I checked this answer - seems to be doing something close to what you need: Reading properties from tomcat I came up q ... -
Tomcat - maven - 如何将静态页面添加到WAR文件中?(Tomcat - maven - how to add the static pages to the WAR file?)[2021-10-05]
将所有静态文件放在src/main/webapp ,它应该像魅力一样工作。 要构建应用程序,请尝试运行命令mvn clean install -U 。 Put all your static files inside src/main/webapp and it should work like a charm. To build your application, try running the command mvn clean install -U. -
你可以在默认安装的管理器应用程序中查找Tomcat真正运行的Java版本 。 转到http://hostname:8080/manager/html (通过主机名或本地主机替换主机名),滚动到底部,在那里您会找到“JVM版本”。 选择哪个JVM取决于操作系统和安装方式, http://tomcat.apache.org/tomcat-7.0-doc/setup.html可能会有所帮助。 例如,如果您使用服务包装器 (我会推荐这个用于Windows)运行Windows ,则可以直接在托盘图标 - >配置Tom ...
-
我在这里找到了一个解决方案: https : //tomcat.apache.org/maven-plugin-trunk/executable-war-jar.html 例如,您将serverXml设置为指向本地tomcat安装。
... war or pom ...... ... org.apa ... -
将版本添加到Tomcat路径(Add version to Tomcat path)[2024-03-09]
#标记被视为文件夹标记,因此部署到 /a/b/c/v0.0#app.war 该应用程序将在 http://some.url:port/v0.0/app The # mark gets treated as if it is a folder marker so deploy to /a/b/c/v0.0#app.war And the application will be available at http://some.url:port/v0.0/app -
有办法: 使用以下方面的帮助创建了一个新项目: http : //fruzenshtein.com/setup-of-dynamic-web-project-using-maven/ 添加了jstl依赖关系:
javax.servlet jstl 1.2 runtime -
不,仅仅根据网站的URL检测Tomcat的版本是不可能的。 如果您要在该Web应用程序中获取资源并导致Tomcat抛出错误,并且服务器已配置为此类,则可以在错误消息页面中看到版本号。 一般来说,广告服务器软件的确切版本被认为是一个安全问题,因为如果尝试针对该服务器,某个版本的漏洞很可能会起作用。 如果您没有告诉客户端您是什么版本,他们将被迫尝试特定攻击,然后您可以检测到攻击本身。 No, it's not possible to detect the version of Tomcat just given ...
-
看起来像anwser在这里: https : //github.com/eclipse/webtools.servertools/blob/master/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat /core/internal/TomcatVersionHelper.java 有趣的是,他们不检查外部文件CATALINA_BASE/lib/org/apache/catalina/uti ...