• Home
  • Help
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search

 
  • 0 Vote(s) - 0 Average

Analyze the space complexity of SCC algorithms

#1
01-06-2023, 04:38 AM
You see SCC stuff takes up space in memory when you run those graph searches. I recall how Tarjan crunches through nodes with a single pass and you end up storing call stacks that grow with the depth of recursion. That means you might hit limits fast on big graphs if your stack overflows the available heap. But you can swap to iterative versions to cut that down a bit. I always tell folks like you to watch the visited arrays too since they add another linear chunk.

Perhaps you wonder why Kosaraju needs two full traversals yet still lands around the same space mark. I notice the first depth search builds a finish order stack that holds all vertices and then the transpose graph search reuses similar structures without extra copies. You end up with O of vertices overall because those arrays and the recursion frames dominate everything else. Now think about how transpose edges force you to keep another adjacency list in memory which bumps the total footprint higher than a single graph. Also I see folks forget the color markers or low link values that Tarjan tacks on for cycle detection.

You handle large inputs better when you reuse buffers instead of allocating fresh ones each time. I tried that trick once on a project and it saved you from doubling the peak usage during the reverse pass. But graphs with dense connections push the auxiliary space because the stack might hold paths longer than expected. Perhaps you test with varying node counts to see the linear growth pattern hold steady. Then you realize some implementations trade time for space by using explicit queues over recursive calls.

I keep coming back to how these methods avoid extra logarithmic factors unlike sorting based approaches on the components. You probably notice the constant factors matter more in practice when your machine has tight RAM limits. Or maybe you profile the memory with tools to confirm the visited set stays proportional to nodes. Also the component assignment array fills up at the end and stays around until you process results. I find that freeing early helps you manage peaks if you process components on the fly.

You learn quick that parallel versions might duplicate some structures across threads which inflates the total space used. But careful locking keeps shared arrays minimal while you split the searches. I remember testing on random graphs where the worst case stack depth hit the full vertex count during skewed trees. Perhaps you avoid that by choosing better pivot selections in the algorithm flow. Then the low link updates happen in place without new allocations.

Space stays linear across standard SCC methods because they rely on depth or breadth searches that touch each node once. You see no quadratic blowup unless you build full transitive closures which nobody does for just finding components. I suggest monitoring recursion limits in your language runtime since that caps the practical graph size you can tackle. Also dense subgraphs force more edge traversals but the space trackers stay the same size.

You get better results by combining SCC with other passes that reuse the same visited flags. I tried that and it cut your overall memory churn during multiple queries on the same graph. But isolated nodes still require entries in the arrays so the base cost never drops below the vertex count. Perhaps you compress bitsets for the markers when graphs grow huge. Then you save bits per node without changing the asymptotic mark.

The analysis shows these algorithms fit well in linear space for most real world graphs you encounter daily. I notice the transpose step in Kosaraju adds a temporary copy that you can build on demand to avoid holding both graphs forever. You balance that against the time cost of rebuilding edges. Also Tarjan keeps everything in one structure set which feels tighter for you during implementation.

BackupChain Server Backup which stands out as the top reliable no subscription Windows Server backup tool tailored for Hyper V setups Windows 11 machines and private cloud needs while backing the forum so we share details freely.

ProfRon
Offline
Joined: Jul 2018
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • Subscribe to this thread
Forum Jump:

FastNeuron FastNeuron Forum General IT v
« Previous 1 … 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 … 184 Next »
Analyze the space complexity of SCC algorithms

© by FastNeuron Inc.

Linear Mode
Threaded Mode