Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7578495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:26:43+00:00 2026-05-30T17:26:43+00:00

I’m working with an adjacency matrix summarizing a bipartate graph, such that rows are

  • 0

I’m working with an adjacency matrix summarizing a bipartate graph, such that rows are one group in the graph and columns are the second group. If a row and column have an edge between them, the value is 1, and if not, it is 0. So, my matrices look at follows

  X Y Z
A 0 1 0
B 0 0 1
C 1 1 1

etc.

I want to quantify distribution of overlap in the rows for 1…S selected rows. So, for example, in the above matrix, the average pairwise overlap would be (0+1/3+1/3)/3 = 2/9, the three-wise overlap (there must be a better word for this) would be 0.

I’m searching for an efficient algorithm to do this for N rows and M columns. So far, nothing that I’ve come up with can typically outperform just doing all possible row combinations.

I can do something like look at the probability of overlap for each column – so, something like the number of possible combinations in each column of length S that will include at least 1 item divided by the total number of combinations of rows. But I’ve not figured out a way to use this information to arrive at the proper answer.

I’ve been thinking there must be some sort of scanning algorithm or otherwise that will address this problem for arbitrary values of S, but lack the training in algorithms to know it off of the top of my head. Any thoughts or references?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:26:44+00:00Added an answer on May 30, 2026 at 5:26 pm

    I think that you can compute this fairly efficiently by building up a histogram that tracks how many total 1’s there are in each column. Take your example:

      X Y Z
    A 0 1 0
    B 0 0 1
    C 1 1 1
    

    If you sum the columns, you get 1, 2, and 2, respectively. To find the average pairwise similarity, you can think about finding the average similarity across each column, then taking the average of that. In this case, to find the pairwise similarity, you would ask, for each column, how many pairs of elements there are. For column X this is 0. For column Y this is 1, and for column Z this is 1 as well. If we compute (0/3 + 1/3 + 1/3) / 3, you get 2/9, as required. To find the three-way similarity, you ask how many triplets there are in each column. There are 0 in each, so the average is 0.

    The reason that this works is that the sum you want is

    (Sum (all possible k-tuples of rows) (# column matches across rows / num columns)) / num k-tuples

    You can factor this out to get

    (Sum (all possible k-tuples of rows) (# column matches across rows)) / (num k-tuples * num columns)

    This first sum can then be interchanged to get

    (Sum (all columns) (# k-tuples of rows that match this column)) / (num k-tuples * num columns)

    Computing this sum is a lot easier, because you can just do this:

    1. Compute the column sums.
    2. For each column, find how many ways there are to pick k elements from it (this is equal to n choose k), then divide it by the number of columns.
    3. Divide this total by the number of k-element sets of rows there are (this is the number of rows choose k).

    You can compute n choose k fairly efficiently using the definition of the choose function (in time O(n + k)). If you have R rows and C columns, the total work is:

    1. Summing columns across each row: O(RC)
    2. For column, computing the number of k-element combinations: O(R + k), since the sum is at most R.
    3. Across all columns, computing this total: O(CR + Ck)
    4. Averaging them together: O(C)

    This gives a total runtime of O(CR + Ck). If you bound k by the number of rows, then this runs in time O(CR), I think.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.