SageTex: Relabeling the Vertices

If you use Sage to generate graphs you'll find there are times when the vertices aren't labelled the way you expect them or want them to be:

In this case the graph is the line graph of a complete graph on 5 vertices, so labelling the vertices with 2-tuples makes sense--the vertex (0,2) would correspond to the edge (in K_5) from vertex 0 to vertex 2. but the "None" part of each label is annoying, to say the least. And that has created an additional problem of vertices which are too big. Luckily Sage has the ability to relabel vertices. In this case, I'm going to relabel using the vertices as just 2-tuples corresponding to vertices in K_5 of {1,2,3,4,5} to get:

The relevant part of the code is

g = graphs.CompleteGraph(m)
H= g.line_graph().complement()
H.relabel([(i,j) for i in range(1,m+1) for j in range(i+1,m+1)])

The first line creates the complete graph on m, equal to 5, vertices. The second line uses Sage's knowledge of graphs to create the line graph of K_5. The line

H.relabel([(i,j) for i in range(1,m+1) for j in range(i+1,m+1)])

generates the desired labels and as a result the vertices are not so huge. The code for the figure above can be found on the Graph Theory, Sage, LaTeX page.

Here are some stories that caught my eye.

  • A new math series has launched on PBS: NOVA calls it Inifinte Secrets. And yes, the woman waves her hands a lot.
  • President elect Donald Trump has picked Betsy DeVos as Education Secretary. She is anti Common Core. KHOU has 5 things you should know about her.
  • Gallup pats themselves on the back for accurately predicting the results of the presidential election. They've also given some excuses to explain the failure at the local level: "State polls typically have smaller sample sizes, have more variable quality depending on what organization conducts the poll, are estimating an outcome that can shift more readily because the population is smaller, are often conducted further away from Election Day and are more dependent on precision in estimates of turnout by geography...To the degree that organizations want to predict the Electoral College, they are going to have to find ways to finance or encourage larger-sample, higher-quality state polls, rather than relying on the haphazard polls that happen to be conducted in the various states..". So an "F" performance by most everyone's count but their's. And notice the certainty of the predictions were based on "haphazard polls"---never heard that mentioned before they made themselves look like fools.
  • CNBC reports that a partner of ETS, the company that provides security for the SAT, has helped to compromise the SAT: "When the new SAT was given for the first time in March, the owner of the test took unprecedented steps to stop "bad actors" from collecting and circulating material from the all-important college entrance exam. But in the months since, China's largest private education company has been subverting efforts to prevent cheating, Reuters found. The company, New Oriental Education & Technology Group Inc, has regularly provided items from the tests to clients shortly after the exams are administered. Because material from past SATs is typically reused on later exams, the items New Oriental is distributing could provide test-takers with an unfair advantage....Hundreds of thousands of students enroll in New Oriental's test-prep classes. It has a stock market capitalization of $6.6 billion and a listing on the New York Stock Exchange. New Oriental's founder and executive chairman, Michael Minhong Yu, is a business celebrity in China. Yu's company is also a business partner of Educational Testing Service, or ETS - the New Jersey non-profit that both owns the TOEFL and provides security for the SAT.
  • Reuters on New Oriental hooking up with colleges, too: "Eight former and current New Oriental employees and 17 former Dipont employees told Reuters the firms have engaged in college application fraud, including writing application essays and teacher recommendations, and falsifying high school transcripts. The New Oriental employees said most clients lacked the language skills to write their own essays or personal statements, so counselors wrote them; only the top students did original work. New Oriental and Dipont deny condoning or wittingly engaging in application fraud.".
  • Teachers this generation have a different set of challenges. has a piece on "Police believe students may have hatched an "elaborate plot" to frame their teacher for viewing pornography on his computer at school. Investigators cleared a teacher at Longfellow Middle and High School of wrongdoing after students accused him in November of watching a porn video on his school computer in class, Fox 59 reports. "Investigators believe the teacher left a laptop sitting out, and students were able to breach the (Indianapolis Public Schools') firewall and load a porn website onto the computer," according to the news site. "Police say they discovered inconsistencies in the allegation against the teacher," WTHR reports. "They say the students 'may have been involved in an elaborate plot to frame the teacher.'" "
  • RT has the most gripping video footage, courtesy BBC’s ‘Planet Earth 2’ of a lizard being chased by snakes---lots and lots and lots of snakes. This is a video you must see!!
  • RT on teachers getting in trouble for anti-Trump comments. Meanwhile, has a piece on all the hate crimes inspired by Trump that turned out to be hoaxes. And college snowflakes are melting down again because of Donald Trump winning the election "The University of Michigan’s distressed students were provided with Play-Doh and coloring books, as they sought comfort and distraction. A University of Michigan professor postponed an exam after many students complained about their “serious stress” over the election results. Cornell University held a campuswide “cry-in,” with officials handing out tissues and hot chocolate. One Cornell student said, “I’m looking into flights back to Bangladesh right now so I can remove myself before Trump repatriates me.” The College Fix reported that “a dorm at the University of Pennsylvania … hosted a post-election ‘Breathing Space’ for students stressed out by election results that included cuddling with cats and a puppy, coloring and crafting, and snacks such as tea and chocolate. The University of Kansas reminded its stressed-out students that therapy dogs, a regular campus feature, were available. An economics professor at Yale University made his midterm exam “optional” in response to “many heartfelt notes from students who are in shock over the election returns.” At Columbia University and its sister college, Barnard, students petitioned their professors to cancel classes and postpone exams because they were fearful for their lives and they couldn’t take an exam while crying....Does a person even belong in college if he cannot handle or tolerate differing opinions? My answer is no.” Unfortunately, that's the coming generation. Wonder how they'll handle the inauguration?!? (spoiler alert: badly)
  • on "Students at the University of Pennsylvania have decided that William Shakespeare “doesn’t represent a diverse range of writers,” so they ripped his portrait off the wall in the English department. The triggered students replaced the famous playwrights portrait with that of author Audre Lorde, a black lesbian feminist and civil rights activist who is best known for her poetry. While she is absolutely deserving of honor and respect, there are likely plenty of walls for both. The school, instead of punishing the students for vandalism, are rewarding them and caving to their petulant demands.....Campus Reform noted that the school’s code of conduct expressly prohibits students from  “stealing, damaging, defacing, or misusing the property or facilities of the university or of others.” Yet, universities across the nation continue to teach their students, who are primarily adults, that tantrums work. Sadly, they will likely be ill-prepared to deal with the real world where everything isn’t sunshine, rainbows, and getting their way."
  • The challenges of teaching today's darlings: RT has a headline which says it all. "Master bakers: Omaha high-school pranksters trick teacher into swallowing semen frosting". From the article, "Three freshmen thought it would be funny to masturbate into a container and add the fluid to the frosting ingredients, the Omaha World Herald reports.The students’ 59-year-old female teacher then suffered the misfortune of tasting the boys’ finished product. She noticed the turnovers tasted a little funky.Another student later told the teacher that he had heard the culprits talking about their plans to add something salty to the ingredients.The three boys, ages 14 and 15, were questioned by school authorities. Two admitted to their deed, and a third said he had chickened out of the act.Police were called and the boys’ frosting containers seized.“The students will face consequences,” said Brandi Petersen, a spokesperson for Westside High. “We do not tolerate anything of this nature.Sadly, there is no law against adding bodily fluids to food. While the frosting was no doubt an assault on the senses, it doesn’t count as an actual assault as there was no bodily injury."
  • 21st Century Wire hosts a piece asserting "disturbing development at the University of Oregon, whose administration made clear to its faculty last week that if you say things about race, sexual orientation, sex, religion and so on that enough people find offensive, you could get suspended and possibly even fired. This can happen even to tenured faculty members or to anyone else."

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code