首页 \ 问答 \ 如何将邻接矩阵转换为发生率矩阵,反之亦然?(How do you transform Adjacency matrices to Incidence matrices and vice-versa?)

如何将邻接矩阵转换为发生率矩阵,反之亦然?(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
更新时间:2021-12-14 11:12

最满意答案

#标记被视为文件夹标记,因此部署到

/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

相关问答

更多
  • 答案可以在以下网址找到: https : //tickets.puppetlabs.com/browse/MODULES-1545 有一个例子显示了在哪里提供实际的战争文件名,包括版本号,在哪里提供它没有版本号。 后一个参数确定用于战争文件副本的名称,它是设置上下文根的副本。 重要Puppetlabs Tomcat模块(版本1.6.1)有一个错误,它会阻止它识别更新的war文件。 一位名叫Daniel Haag的人在2015年11月为这个bug提供了一个修复程序。它只适用于你应用Daniels补丁。 为什么 ...
  • 我检查了这个答案 - 似乎正在做一些你需要的东西: 从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 ...
  • 将所有静态文件放在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 ...
  • #标记被视为文件夹标记,因此部署到 /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 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。