In an effort to stretch the floor and add someone who can mentor their legion of young players, the Orlando Magic have reached an agreement with free-agent power forward Channing Frye on a four-year, $32 million contract.

After Frye missed the entire 2012-13 season because of an enlarged heart, he staged an impressive return last season. He averaged 11.1 points and 5.1 rebounds per game for the Phoenix Suns and appeared in all 82 of the Suns’ games.

He sank 37.0 percent of his 3-point tries last season and has made 38.5 percent of his 3s during his pro career.

Magic officials likely view his long-range shooting as an asset that can create space for youngsters such as Victor Oladipo, Elfrid Payton, Aaron Gordon, Maurice Harkless and Tobias Harris to attack the rim.

In recent weeks, the Magic traded away leading scorer Arron Afflalo and waived longtime point guard Jameer Nelson. Those moves left Orlando dangerously deficient in 3-point shooting and in experience.

Excluding Frye but including impending free-agent signee Ben Gordon, the average age of Orlando’s roster is 23.8 years old.

Frye, 31, likely is expected to serve as a locker-room leader.

Frye also is Harris’ first cousin.

“As a kid, I used to watch all his college games at Arizona,” Harris told the Orlando Sentinel in March. “I used to know all his stats. So I followed him. . . . It made me want to get in the NBA even more. He's somebody I looked up to. I just always wanted to get to the NBA and be at that same level.”

Frye’s and Harris’ maternal grandfather, John Mulzac, was a member of the Tuskegee Airman during World War II.

New Orleans agreed with Anderson on a four-year package worth $34 million and ultimately sent Gustavo Ayón to Orlando in a sign-and-trade deal for Anderson.

Magic officials didn’t regard Anderson, who was 24 then, as a solid enough player for that amount of money. Still, Anderson was regarded as a far better rebounder than Frye and probably just as strong a shooter.

Now, the Magic are about to sign Frye to a deal that’s similar to Anderson’s with New Orleans.

At 6-feet-11 and 245 pounds and not terribly athletic, Frye doesn’t predicate his game on power, but he’s a better defender than he typically is given credit for. He confounded Los Angeles Clippers All-Star Blake Griffin on at least one occasion.

Last season, most analysts predicted the Suns would be one of the worst teams in the NBA because of their youth.

But Phoenix posted a 48-34 record and narrowly missed the final playoff spot in the ultracompetitive Western Conference.

Now, Frye will soon join a team with low expectations — and a team that already has his first cousin, Harris.

“I think, in all honesty, he’s going to be better than I am,” Frye told the Sentinel in March about Harris. “He works so tremendously hard, and he’s extremely talented. We grew up on different coasts, so I wasn’t there a lot of times. But the times we had, it was all of us. We’re a very tight-knit family. We just want to see each other do well.”