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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:28:44+00:00 2026-06-13T00:28:44+00:00

I need to output the girth of a given graph represented as an adjacency

  • 0

I need to output the girth of a given graph represented as an adjacency matrix.Could anyone give me some hints how i can use an adjacency matrix or an adjacency list to obtain the girth of a graph?

Example:

graph one:
0 1 0 0
1 0 0 1
0 0 0 0
0 1 0 0 

graph two:
0 1 0 0 1
1 0 1 0 0
0 1 0 1 0
0 0 1 0 1
1 0 0 1 0

The result:
Girth of graph 1: infinity
Girth of graph 2: 5
  • 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-13T00:28:45+00:00Added an answer on June 13, 2026 at 12:28 am

    This algorithm will find the length of the shortest cycle:

    - set `girth` to infinity
    - for each edge
    -- remove the edge from the graph
    -- measure the distance between the edge endpoints
    -- if `girth` is longer than distance+1
    --- set `girth` to distance+1
    -- return the edge to the graph.
    

    The time complexity is of the Dijkstra’s algorithm is O(v^2), so this algorithm is O(v^4).

    If your graph is sparse, you can convert to a neighbor-list representation and then run the previous algorithm in O(v^2+e*(e+v*log(v)))=O(v^2+e^2+v*e*log(v))

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

Sidebar

Related Questions

I need to output some JavaScript in a WebControl based on some processing and
Need: Output a Java application's log into a GUI component, such as a JTextArea.
I need output different information to different terminal instances instead of print them in
I need to copy from input document to output document all attributes but one.
<block4> <tag> <name>72</name> <value>/BNF/RED-AAF-US EQUITY GROWTH FUND //FETA/ABNAAFU000000D93--16.560-10/</value> </tag> </block4> i need output like
I have below 2 Tables I need to get output witout temp tables WorkItem
I'm writing a custom widget that requires some supporting javascript code that I need
I need to output the contents of a text field using MS Query Analyzer.
I need to output the same text to two different files (it is a
I need to output 4 different floats to two decimal places. This is what

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.