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 8056367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:40:54+00:00 2026-06-05T08:40:54+00:00

I have a network. In which the nodes are connected like this : A-B

  • 0

I have a network.
In which the nodes are connected like this :

A-B
B-C
A-C
B-D
E-F
F-G
H-G
H-E

I want them to be clustered like ABCD and EFGH.
Is there a way to do it in R??

  • 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-06-05T08:40:55+00:00Added an answer on June 5, 2026 at 8:40 am

    Thought I’d bang together a direct solution to provide a useful comparison (and practice my coding – all pointers welcome…)

    ## initial link data frame (with start and end points)
    link=data.frame(st=c("A","B","A","B","E","F","H","H"),
                    end=c("B","C","C","D","F","G","G","E"),
                    stringsAsFactors=FALSE)
    
    ## form blank list where clusters will build up (works up 
    ## to n=26!)
    n=nrow(link)
    L=c(); for (j in seq_len(n)) {L=c(L,list(NULL))}
    names(L)=LETTERS[seq_len(n)]
    
    ## for each link in turn, pull together a collection of
    ## everything in the same cluster as either end, and update
    ## all relevant entries in L
    for (j in seq_len(n)) {
        clus=sort(unique(c(link$st[j],link$end[j],
                           L[[link$st[j]]],L[[link$end[j]]])))
        for (k in clus) {L[[k]]=clus}
    }
    print(L)
    

    The output is, as expected:

    $A
    [1] "A" "B" "C" "D"
    
    $B
    [1] "A" "B" "C" "D"
    
    $C
    [1] "A" "B" "C" "D"
    
    $D
    [1] "A" "B" "C" "D"
    
    $E
    [1] "E" "F" "G" "H"
    
    $F
    [1] "E" "F" "G" "H"
    
    $G
    [1] "E" "F" "G" "H"
    
    $H
    [1] "E" "F" "G" "H"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this error which happen many times on my site: A network-related or
I have a network of nodes, some of which are related to one another.
I have a application which I suspects to get into problems because network nodes
I am developing a network protocol In which I have following requirement each node
I have a network software which uses UDP to communicate with other instances of
I have a camera on my network which I am trying to connect to
I'm designing an application which will have a network interface for feeding out large
Say I have a resource (e.g. a filehandle or network socket) which has to
I have an application which runs a tool that requires network connection. Now my
I have a socket application which I can use in local network, at home.

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.