A list of puns related to "Strongly connected component"
Let's have a standard topological ordering algorithm (from CLRS):
Topological_ordering(G)
foreach vertex v in V do
v.color = white
for each vertex v in V do
if v.color = white then
Stack = DFS(G, v, Stack)
return Stack
// DFS
DFS (G, v, Stack)
v.color = gray
for each u adjacent of v do
if u.color = white then
Stack = DFS(G, u, Stack)
v.color = black
Stack.push(v)
return stack
Now let's apply this to a cyclic graph G.
We will not have a topological ordering of the vertices of G, but we shall have a topological ordering of the graph of the Strongly Connected Components
>The graph of the Strongly Connnected Components derived from the graph G is a graph in which each SCC is represented by only one vertex (also called compressed SCC graph
For example let's look at this graph: https://imgur.com/a/0EXOxJt (sorry for the poor drawing skills). In green the SSC of this graph.
Applying the algorithm above, one possible stack configuration is:
head ----> 2 ; 3 ; 4 ; 5 ; 1 ; 6 , 8 ; 7 ; 9
As you can see the elements of an SCC are "all together". How to prove this mathematically? Thank you.
I don't understand why the stack in this algorithm is needed. there is a stack which you do DFS and insert all vertices when they finish to the stack.
instead of a stack why not do a for loop over all vertices and do DFS if they are not visited?
why the algorithm is not like that:
So, I am trying to solve a SCC problem, and come across this algorithm. I am basing myself on this wiki link and this video (he starts to talk about the part I am in doubt at 15:13)
So, I still haven't implemented on code, because I'm still trying to understand how some stuff work, and how I will need to change some stuff from both sources, since they are in pseudo-code. But I ran through paper the case 0R1, 1R2, 1R3, 3R0, and came to find that node 2 would be wrongly assigned as part of the component because of this line:
if(ids[at] == low[at]):
//...
low[node] = ids[at]
So, before I thought this line was just redundancy, because I couldn't find a case where it would be useful, but now, it's even starting to make mistakes on the code!
I know this is a highly specific question, and it's poorly presented, but I just thought I would try my luck, thanks to anyone that spends time trying to understand this thing!
EDIT: SOLVED!!!
you can see scc.py and scc2.py through the github link. scc.py runs in minutes, and scc2.py runs in hours
the difference is using a defaultdict(list) to track the groups. I will create another post to ask why it makes such a big difference.
So, I'm taking Algorithms1 through Coursera at the moment. And the last homework was to compute strongly connected components of a graph. I was able to achieve this, but the runtime of my algorithm was in hours- other people on the forum claimed to do it in under a minute.
my implementation with the actual dataset and some test sets can be seen here
https://github.com/hennymac/Algorithms1/tree/master/Week4
I would really appreciate any help
*note: I had to adjust the maximum recursion depth in order to accomplish this.
class Track(object):
"""Keeps track of explored, time, source, leader, et cetera"""
def __init__(self,explored):
self.explored = explored
self.current_time = 0
self.current_source = None
self.leader = {}
self.finish_times = {}
def addNode(self,node):
"""adds node to SCC group"""
self.leader[self.current_source] = self.leader.get(self.current_source,[]) + [node]
def scc(graph,reverse_graph,nodes):
explored = [False for i in range(len(nodes))]
track = Track(explored)
dfs_loop(reverse_graph,nodes,track)
sorted_nodes = sorted(track.finish_times, key=track.finish_times.get,reverse=True)
explored = [False for i in range(len(nodes))]
track = Track(explored)
dfs_loop(graph,sorted_nodes,track)
return track
def dfs(graph,start,track):
track.explored[start] = True
track.addNode(start)
for edge in graph[start]:
if not track.explored[edge]:
dfs(graph,edge,track)
track.current_time += 1
track.finish_times[start] = track.current_time
def dfs_loop(graph,nodes,track):
for node in nodes:
if not track.explored[node]:
track.current_source = node
dfs(graph,node,track)
I'm not sure if this is the right place to ask, so tell me if you think there is a better subreddit
According to this link: http://www9.org/w9cdrom/160/160.html the main SCC of the web was over 50M pages in 1999. Is there any source that tracks this currently?
Would scaling 50M by some growth factor provide a reasonable estimate? I'm not sure if this is a valid thing to do on SCC because the number of interconnected websites is not necessarily proportional to the total amount of information on the web...
Hello, first off, let me say that I am not looking for a complete solution, but merely for a few hints that could help me accomplish the task. Posting here because I'm completely stumped and have no idea how to solve this myself.
The task is as following:
We are given a directed acyclic graph. Each vertex of this graph is assigned a value. By reversing the direction of an edge, the graph may no longer be acyclic, therefore strongly connected components may appear after this action. We are supposed to find such an edge whose reversal will create a strongly connected component whose sum of the vertex values is the maximum possible.
And here is the catch: this algorithm has to run in linear time.
Obviously, there's the bruteforce approach which tries reverting every edge one by one and then runs KosarajuβSharir or Tarjan's algorithm on the graph, but we end up with a O((V+E)E) complexity, which invalidates this approach.
I believe there's a possibility that this algorithm can be solved by a modification of one of the algorithms, or with the help of topological ordering of the graph (every DAG has a topological order). But maybe I am wrong and have to take an entirely different approach to this.
Any insights or hints would be very welcome. I want to figure this out myself, but I need some sort of a push. Thanks.
Whenever I mention the name Angelica, people usually state that the name has a bratty imagery and feel to it. Some people believe that the name carries that aura on its own whereas a lot of people associate with the character named Angelica on the cartoon "Rugrats" who was very unruly and mischievous.
Certain names are so strongly associated with pop culture references that it ends up kind of overpowering the name itself i.e. Casper. Is Angelica the same?
https://www.youtube.com/watch?v=OFdVicdk8Xw
from around 11:00
I hope 2022 will become silver year. knowledgeable persons foresee strong silver's future, for example First Majestic silver and Endeavour silver reserve silver in their storages.
Anyone familiar with the concept of a βcomfort showβ?
For me, it dawned on me that not only are the potentials often kind of annoying, but the whole season really separates the core Scoobs like never before. We see way less moments of them together because of all the new cast additions, and you knowβ¦ Empty Places. Iβm sure many of us love this show because we wish we had a tight knit group like the Scoobies. The show empowered me and helped me feel less alone. Iβve always been a huge sucker for anything with close-knit group dynamics (like Harry Potter and the trio, no not that Trio, I mean Harry, Hermoine and Ron) and season 7 completely obliterates that comfort aspect of the series.
And thatβs what Buffy brings meβ¦ comfort. But not S7β¦
So, if S7 is your least favourite, do you relate to this reason? Whatβs your reasoning behind liking S7 the least?
That's it. Wonder if u have any thoughts
I have an application where I communicate with a backend whereby a specific request type always results in a specific response type. I'd like to model this in types, somehow.
Something like:
export type RequestResponsePair =
| { request: { type: "init", param: number }, response: { "success": boolean } }
| { request: { type: "close", force: boolean }, response: { "closed": boolean } }
Meaning that if I send an `init` request, I always need to specify a `param`, and I will always receive a response with a `success` boolean. And if send a `close` request, I need to specify a `force` boolean, and I'll receive a response with a `closed` boolean.
My TypeScript-fu is fairly weak, so I was wondering how to model these types so that I can create some kind of `send` function, like:
function send<T extends RequestResponsePair>(request: ???): ??? {...}
And the usage would be:
const response = send({ type: "init", param: 123});
console.log(response.success);
Good lord that was an amazing experience. For those of you with the option to play in VR, I highly recommend it! I'm reeling with what a beautiful experience that was. I'm a habitual gamer and have played just about everything but this game has elevated my opinions about what is possible in the medium. It is so interesting to play a game that's core mechanic is learning and knowledge!
Thank you Mobius. Any game of yours is an insta-buy for me.
I cannot believe how smart this game is. It broke my brain and hit my right in the feels. It's a rainy weekend here and I guess tomorrow I'll try to figure out how to begin the Echoes of the Eye content.
I actually tried the game a couple of years ago but got frustrated and gave up. I'm so glad I stuck with it this time. The immersion provided by VR definitely helped. I also really did require a few nudges (so thank you to this sub for the attention given to spoilers). I was also playing this in my non-native language which I think caused me to miss a few clues. It did however deepen the sense of deliberate attention and problem-solving needed to figure things out. Spoilery stuff:
Something about Caspian really hits home with my tastes. Godspeed You! Black Emperor is cool but i donβt listen to them much. Explosions in the sky have some cool songs. I like a bit of God Is An Astronaut. But none of it really has the feel Caspian has. I think itβs cause I prefer the more upbeat and melodic kind of Post Rock, not the slow and melancholic stuff that Godspeed has.
Hi there
I'm interested if any of you know about some interesting crime case which is somehow strongly connected with any kind of media (social media, press media.. doesn't matter - I just need the connection)
It would be great if the case was super interesting, maybe morbid or controversial (even occult stuff would be interesting)
But! It needs to be connected with media (doesn't matter if the media itself was involved or it happened on the media - just any connection)
If you have any ideas, tell me. I'll appreciate it!
Thanks for reading and have a great day!
(Just to explain why I'm asking - I need it for my presentation for 'medial communication')
Just a quick question due to the fact off me being pretty nee to CCW. Why does CCW not like any white in images made as .png? Also why doesn't it show the transparency?
Howdy all
I bought this asrock x399 fatal1ty motherboard off someone on offerup, however as soon as I pressed the power button the board started smoking. After doing a quick visual on the board it appears they failed to tell me that an SMD on the back of the board was broken off the board (it didn't look "blown" but I don't really know what I'm looking at). was just labelled R10 and I have been unsuccessful in finding what part it could be, as I haven't gotten any real matches. The closest I've gotten is finding a 250mW current sensing resistor (RL1220S-R10-F) but it didn't look the same. The smoke seemed to be coming from the same side as the broken part so I'd wager that it was causing the issue but if anyone else has any thoughts I'm all ears.
Here's a photo of the board and how it was originally attached.
I tried contacting the seller on offerup but they basically told me to pound sand. If anyone here knows anything about this I'd be forever in your debt if I'd be able to find the component and solder it back on. Also on a somewhat related note, one side seemed to have two metal leads coming out of it and the other side only had one, but on the mobo itself both sides seemed to have only one contact.
So I'm just starting to dabble in CCW and the micro800 series. Not entirely sure how I feel about it. So features are nice..... so not so much. One issue I've been having for days is getting my analog outputs to take my 4-20ma singal. I'm using the OF4 analog output extension.Is there anything special I need to do? Any scaling, or initiating?
Can basins merge together in a larger basin?
Edit: I just need to read. The answer is NO.
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.